- 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
This commit is contained in:
alexey.lysiuk 2023-08-22 13:49:32 +03:00
parent 22271d146a
commit ae2fa11963

View file

@ -282,6 +282,7 @@ extern bool AppActive;
{ {
ZD_UNUSED(aNotification); ZD_UNUSED(aNotification);
if (GSnd)
S_SetSoundPaused(1); S_SetSoundPaused(1);
AppActive = true; AppActive = true;
@ -291,6 +292,7 @@ extern bool AppActive;
{ {
ZD_UNUSED(aNotification); ZD_UNUSED(aNotification);
if (GSnd)
S_SetSoundPaused(0); S_SetSoundPaused(0);
AppActive = false; AppActive = false;