diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index d460cf1d7b..13fa721d9b 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -65,6 +65,16 @@ LowLevelWindow_X11::~LowLevelWindow_X11() XUngrabKeyboard( Dpy, CurrentTime ); } + if( g_pContext ) + { + glXDestroyContext( Dpy, g_pContext ); + g_pContext = NULL; + } + if( g_pBackgroundContext ) + { + glXDestroyContext( Dpy, g_pBackgroundContext ); + g_pBackgroundContext = NULL; + } XDestroyWindow( Dpy, Win ); Win = None; XDestroyWindow( Dpy, g_AltWindow ); @@ -140,6 +150,10 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe XChangeProperty( Dpy, Win, XA_WM_NAME, XA_STRING, 8, PropModeReplace, reinterpret_cast(szWindowTitle), strlen(szWindowTitle) ); + if( g_pContext ) + glXDestroyContext( Dpy, g_pContext ); + if( g_pBackgroundContext ) + glXDestroyContext( Dpy, g_pBackgroundContext ); g_pContext = glXCreateContext( Dpy, xvi, NULL, True ); g_pBackgroundContext = glXCreateContext( Dpy, xvi, g_pContext, True );