mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibAudio: Clear callbacks and disconnect PulseAudioStream in destructor
If we don't clear the callbacks, they may be called after our functions are deleted. Disconnecting the stream also doesn't appear to be done automatically when calling `pa_stream_unref()` for the last time, so let's do that.
This commit is contained in:
parent
2de3cee8ea
commit
515b255fa4
1 changed files with 7 additions and 0 deletions
|
@ -266,11 +266,18 @@ ErrorOr<NonnullRefPtr<PulseAudioStream>> PulseAudioContext::create_stream(Output
|
|||
wait_for_signal();
|
||||
}
|
||||
|
||||
pa_stream_set_state_callback(stream, nullptr, nullptr);
|
||||
|
||||
return stream_wrapper;
|
||||
}
|
||||
|
||||
PulseAudioStream::~PulseAudioStream()
|
||||
{
|
||||
auto locker = m_context->main_loop_locker();
|
||||
pa_stream_set_write_callback(m_stream, nullptr, nullptr);
|
||||
pa_stream_set_underflow_callback(m_stream, nullptr, nullptr);
|
||||
pa_stream_set_started_callback(m_stream, nullptr, nullptr);
|
||||
pa_stream_disconnect(m_stream);
|
||||
pa_stream_unref(m_stream);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue