1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

LibAudio: Initialize enqueuer event loop to null pointer

If this is not done, the event loop pointer will be initialized to
exploded MALLOC_SCRUB_BYTEs and the null pointer check at destruction
time will fail, causing a crash any time an audio client without a
started enqueuer thread exits. With this change, we correctly skip
quitting the event loop both when it was never started (if the enqueuer
thread never ran) as well as if it already exited (if the enqueuer
thread exited fast enough) without additional logic for the two very
different cases.
This commit is contained in:
kleines Filmröllchen 2022-11-10 21:03:36 +01:00 committed by Andrew Kaster
parent 457fda6354
commit 9d0b56b1fc

View file

@ -81,7 +81,7 @@ private:
NonnullOwnPtr<UserSampleQueue> m_user_queue; NonnullOwnPtr<UserSampleQueue> m_user_queue;
NonnullRefPtr<Threading::Thread> m_background_audio_enqueuer; NonnullRefPtr<Threading::Thread> m_background_audio_enqueuer;
Core::EventLoop* m_enqueuer_loop; Core::EventLoop* m_enqueuer_loop { nullptr };
Threading::Mutex m_enqueuer_loop_destruction; Threading::Mutex m_enqueuer_loop_destruction;
// A good amount of time to sleep when the queue is full. // A good amount of time to sleep when the queue is full.