Fix random multithreaded crash that happens when setting the audio stream on a AudioStreamRandomPitch stream.
This commit is contained in:
parent
01c78d87fe
commit
df74f14605
1 changed files with 2 additions and 0 deletions
|
@ -231,12 +231,14 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() {
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) {
|
void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) {
|
||||||
|
AudioServer::get_singleton()->lock();
|
||||||
audio_stream = p_audio_stream;
|
audio_stream = p_audio_stream;
|
||||||
if (audio_stream.is_valid()) {
|
if (audio_stream.is_valid()) {
|
||||||
for (Set<AudioStreamPlaybackRandomPitch *>::Element *E = playbacks.front(); E; E = E->next()) {
|
for (Set<AudioStreamPlaybackRandomPitch *>::Element *E = playbacks.front(); E; E = E->next()) {
|
||||||
E->get()->playback = audio_stream->instance_playback();
|
E->get()->playback = audio_stream->instance_playback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AudioServer::get_singleton()->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<AudioStream> AudioStreamRandomPitch::get_audio_stream() const {
|
Ref<AudioStream> AudioStreamRandomPitch::get_audio_stream() const {
|
||||||
|
|
Loading…
Reference in a new issue