From 9d0b56b1fc8add68a4005c7be2bccf8621909990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Thu, 10 Nov 2022 21:03:36 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibAudio/ConnectionToServer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index 7abd516aa5..ca840d90a2 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -81,7 +81,7 @@ private: NonnullOwnPtr m_user_queue; NonnullRefPtr m_background_audio_enqueuer; - Core::EventLoop* m_enqueuer_loop; + Core::EventLoop* m_enqueuer_loop { nullptr }; Threading::Mutex m_enqueuer_loop_destruction; // A good amount of time to sleep when the queue is full.