From ae2fa11963242cf730ef332d8af4033bd2c26fdc Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 22 Aug 2023 13:49:32 +0300 Subject: [PATCH] - added safeguards against very early access to console variables in Cocoa backend for an unknown reason, application activation functions can be called way too early during app launch `S_SetSoundPaused()` function tries to read values of `i_pauseinbackground` and `i_soundinbackground` console variables before their initialization leading to a null pointer dereference https://forum.zdoom.org/viewtopic.php?t=78092 --- src/common/platform/posix/cocoa/i_main.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/platform/posix/cocoa/i_main.mm b/src/common/platform/posix/cocoa/i_main.mm index 8a9d96b07..8c58ca419 100644 --- a/src/common/platform/posix/cocoa/i_main.mm +++ b/src/common/platform/posix/cocoa/i_main.mm @@ -282,7 +282,8 @@ extern bool AppActive; { ZD_UNUSED(aNotification); - S_SetSoundPaused(1); + if (GSnd) + S_SetSoundPaused(1); AppActive = true; } @@ -291,7 +292,8 @@ extern bool AppActive; { ZD_UNUSED(aNotification); - S_SetSoundPaused(0); + if (GSnd) + S_SetSoundPaused(0); AppActive = false; }