mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00: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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user