summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Miell <nmiell@gmail.com>2012-01-02 14:28:45 -0700
committerBrian Paul <brianp@vmware.com>2012-01-02 14:28:51 -0700
commitb84d22238b6a4b0b46c72bc693a62ae3a7b0b78e (patch)
tree6975b14145aded0e1befb69d7d06c4b6d19d6d81
parentf6d1f5dfe0421c15cf38ff49c67ded8f9f7dc63a (diff)
Release GLX context before destroying the window
GLEAN::Window::~Window was calling XDestroyWindow on the currently bound GLX drawable, which would cause the subsequent test to explode when it called glXMakeCurrent and Mesa attempted to flush the outstanding state to the now destroyed window. Now the Window destructor checks if the window being destroyed is bound to the current GLX context, and if so, releases the current GLX context before destroying the window. I also included the equivalent WGL change, but that is untested. The AGL and BeOS versions are untouched, but probably needs something similar. With this change, the glean basic sanity test now passes on Mesa swrast. Signed-off-by: Nicholas Miell <nmiell@gmail.com> Signed-off-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/glean/dsurf.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glean/dsurf.cpp b/src/glean/dsurf.cpp
index 84e4fda..8aa1e67 100644
--- a/src/glean/dsurf.cpp
+++ b/src/glean/dsurf.cpp
@@ -188,8 +188,12 @@ DrawingSurface::commonDestructorCode() {
Window::~Window() {
#if defined(__X11__)
+ if (glXGetCurrentDrawable() == xWindow)
+ glXMakeCurrent(winSys->dpy, None, NULL);
XDestroyWindow(winSys->dpy, xWindow);
#elif defined(__WIN__)
+ if (wglGetCurrentDC() == hDC)
+ wglMakeCurrent(NULL, NULL);
ReleaseDC(hWindow,hDC);
DestroyWindow(hWindow);