C4AppGTK: Avoid SEGV on quit during initialization

When C4AbstractApp is destroyed, it will try to reset the current
video mode. This includes switching off the fullscreen flag of the
render window. When no render window has been created yet, for
example during the application initialization phase, this led to a
null pointer dereference due to a missing check.
stable-5.4
Nicolas Hake 2013-10-31 23:21:07 +01:00
parent feae5c8ea3
commit 82b15553a1
1 changed files with 4 additions and 1 deletions

View File

@ -189,7 +189,10 @@ void C4AbstractApp::RestoreVideoMode()
XRRFreeScreenConfigInfo(conf);
fDspModeSet = false;
}
gtk_window_unfullscreen(GTK_WINDOW(pWindow->window));
// pWindow may be unset when C4AbstractApp gets destroyed during the
// initialization code, before a window has been created
if (pWindow)
gtk_window_unfullscreen(GTK_WINDOW(pWindow->window));
}
bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)