Delete window surfaces before breaking the connection to the X server

Otherwise, destroying the OpenGL context would crash.
stable-5.1
Günther Brammer 2010-03-25 20:58:46 +01:00
parent 5631bb197d
commit c40456b55e
3 changed files with 10 additions and 0 deletions

View File

@ -413,6 +413,13 @@ void C4FullScreen::Close()
Application.Quit();
}
void C4FullScreen::Clear()
{
if (pSurface) delete pSurface;
pSurface = 0;
CStdWindow::Clear();
}
void C4FullScreen::Execute()
{
// Execute menu

View File

@ -46,6 +46,7 @@ class C4FullScreen: public CStdWindow
bool MenuKeyControl(BYTE byCom); // direct keyboard callback
// User requests close
virtual void Close();
virtual void Clear();
virtual void CharIn(const char * c);
#ifdef USE_X11
virtual void HandleMessage (XEvent &e);

View File

@ -1190,6 +1190,8 @@ void C4Console::Clear()
ClearViewportMenu();
ClearPlayerMenu();
ClearNetMenu();
if(pSurface) delete pSurface;
pSurface = 0;
#ifndef _WIN32
Application.Quit();
#endif