summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-01 16:42:50 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-01 16:43:46 -0300
commit42659b0d9f29967a89d5055f23decacb81018509 (patch)
tree499d320be26d3d068de079c79b188326e6884741
parent3694c58d3cb9f2af41a8f964e00712bb5578af76 (diff)
Fix freeze on exit on audiostreamplayers when setting invalid stream, closes #10093
-rw-r--r--scene/2d/audio_stream_player_2d.cpp4
-rw-r--r--scene/3d/audio_stream_player_3d.cpp4
-rw-r--r--scene/audio/audio_player.cpp4
3 files changed, 7 insertions, 5 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index eb186a8e1f..39d3f2d6bf 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -246,12 +246,14 @@ void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
stream = p_stream;
stream_playback = p_stream->instance_playback();
+ AudioServer::get_singleton()->unlock();
+
if (stream_playback.is_null()) {
stream.unref();
ERR_FAIL_COND(stream_playback.is_null());
}
- AudioServer::get_singleton()->unlock();
+
}
Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 6efdf25f0d..1ad36102ba 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -555,12 +555,12 @@ void AudioStreamPlayer3D::set_stream(Ref<AudioStream> p_stream) {
stream = p_stream;
stream_playback = p_stream->instance_playback();
+ AudioServer::get_singleton()->unlock();
+
if (stream_playback.is_null()) {
stream.unref();
ERR_FAIL_COND(stream_playback.is_null());
}
-
- AudioServer::get_singleton()->unlock();
}
Ref<AudioStream> AudioStreamPlayer3D::get_stream() const {
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 5d71f702df..8bd924e7ce 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -139,12 +139,12 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
stream = p_stream;
stream_playback = p_stream->instance_playback();
+ AudioServer::get_singleton()->unlock();
+
if (stream_playback.is_null()) {
stream.unref();
ERR_FAIL_COND(stream_playback.is_null());
}
-
- AudioServer::get_singleton()->unlock();
}
Ref<AudioStream> AudioStreamPlayer::get_stream() const {