From 7811c2e71be2d5557b9233fd2d90823563c8fec3 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Thu, 4 Sep 2025 12:01:47 -0500 Subject: [PATCH] LibMedia: Ensure that the PulseAudioContext atexit() call succeeds --- Libraries/LibMedia/Audio/PulseAudioWrappers.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibMedia/Audio/PulseAudioWrappers.cpp b/Libraries/LibMedia/Audio/PulseAudioWrappers.cpp index 48d762850c8..3c7ca20bee1 100644 --- a/Libraries/LibMedia/Audio/PulseAudioWrappers.cpp +++ b/Libraries/LibMedia/Audio/PulseAudioWrappers.cpp @@ -23,10 +23,13 @@ ErrorOr> PulseAudioContext::instance() static Threading::Mutex instantiation_mutex; // Lock and unlock the mutex to ensure that the mutex is fully unlocked at application // exit. - atexit([]() { + auto atexit_result = atexit([]() { instantiation_mutex.lock(); instantiation_mutex.unlock(); }); + if (atexit_result) { + return Error::from_string_literal("Unable to set PulseAudioContext atexit action"); + } auto instantiation_locker = Threading::MutexLocker(instantiation_mutex);