LibMedia: Ensure that the PulseAudioContext atexit() call succeeds

This commit is contained in:
Zaggy1024 2025-09-04 12:01:47 -05:00 committed by Jelle Raaijmakers
parent ee3c080fb5
commit 7811c2e71b
Notes: github-actions[bot] 2025-09-04 17:39:13 +00:00

View file

@ -23,10 +23,13 @@ ErrorOr<NonnullRefPtr<PulseAudioContext>> 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);