From d92dcfc6f7195f131232dd4cdcb7102d1b34afe7 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Thu, 7 Dec 2006 12:03:48 +0000 Subject: [PATCH] Delete the gl contexts when we create new ones or shut down. --- .../src/arch/LowLevelWindow/LowLevelWindow_X11.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 );