diff options
Diffstat (limited to 'scene/audio')
-rw-r--r-- | scene/audio/audio_stream_player.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 1478cbf69e..9383355292 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -146,7 +146,7 @@ void AudioStreamPlayer::_notification(int p_what) { if (!active.is_set() || (setseek.get() < 0 && !stream_playback->is_playing())) { active.clear(); set_process_internal(false); - emit_signal("finished"); + emit_signal(SNAME("finished")); } } @@ -202,8 +202,12 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { } if (p_stream.is_valid()) { - stream = p_stream; stream_playback = p_stream->instance_playback(); + if (stream_playback.is_valid()) { + stream = p_stream; + } else { + stream.unref(); + } } AudioServer::get_singleton()->unlock(); |