Fix freeze on exit on audiostreamplayers when setting invalid stream, closes #10093
This commit is contained in:
parent
3694c58d3c
commit
42659b0d9f
3 changed files with 7 additions and 5 deletions
|
@ -246,12 +246,14 @@ void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
|
||||||
stream = p_stream;
|
stream = p_stream;
|
||||||
stream_playback = p_stream->instance_playback();
|
stream_playback = p_stream->instance_playback();
|
||||||
|
|
||||||
|
AudioServer::get_singleton()->unlock();
|
||||||
|
|
||||||
if (stream_playback.is_null()) {
|
if (stream_playback.is_null()) {
|
||||||
stream.unref();
|
stream.unref();
|
||||||
ERR_FAIL_COND(stream_playback.is_null());
|
ERR_FAIL_COND(stream_playback.is_null());
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
|
Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
|
||||||
|
|
|
@ -555,12 +555,12 @@ void AudioStreamPlayer3D::set_stream(Ref<AudioStream> p_stream) {
|
||||||
stream = p_stream;
|
stream = p_stream;
|
||||||
stream_playback = p_stream->instance_playback();
|
stream_playback = p_stream->instance_playback();
|
||||||
|
|
||||||
|
AudioServer::get_singleton()->unlock();
|
||||||
|
|
||||||
if (stream_playback.is_null()) {
|
if (stream_playback.is_null()) {
|
||||||
stream.unref();
|
stream.unref();
|
||||||
ERR_FAIL_COND(stream_playback.is_null());
|
ERR_FAIL_COND(stream_playback.is_null());
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<AudioStream> AudioStreamPlayer3D::get_stream() const {
|
Ref<AudioStream> AudioStreamPlayer3D::get_stream() const {
|
||||||
|
|
|
@ -139,12 +139,12 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
||||||
stream = p_stream;
|
stream = p_stream;
|
||||||
stream_playback = p_stream->instance_playback();
|
stream_playback = p_stream->instance_playback();
|
||||||
|
|
||||||
|
AudioServer::get_singleton()->unlock();
|
||||||
|
|
||||||
if (stream_playback.is_null()) {
|
if (stream_playback.is_null()) {
|
||||||
stream.unref();
|
stream.unref();
|
||||||
ERR_FAIL_COND(stream_playback.is_null());
|
ERR_FAIL_COND(stream_playback.is_null());
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<AudioStream> AudioStreamPlayer::get_stream() const {
|
Ref<AudioStream> AudioStreamPlayer::get_stream() const {
|
||||||
|
|
Loading…
Reference in a new issue