projects
/
occt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
af324fa
)
0024747: TKOpenGl - Mesa fails to destroy context if it set to current thread
author
apl
<apl@opencascade.com>
Fri, 28 Mar 2014 07:34:27 +0000
(11:34 +0400)
committer
apn
<apn@opencascade.com>
Thu, 3 Apr 2014 11:35:13 +0000
(15:35 +0400)
src/OpenGl/OpenGl_Window.cxx
patch
|
blob
|
blame
|
history
diff --git
a/src/OpenGl/OpenGl_Window.cxx
b/src/OpenGl/OpenGl_Window.cxx
index
9f39063
..
ba96435
100644
(file)
--- a/
src/OpenGl/OpenGl_Window.cxx
+++ b/
src/OpenGl/OpenGl_Window.cxx
@@
-592,19
+592,18
@@
OpenGl_Window::~OpenGl_Window()
}
// release "GL" context if it is owned by window
}
// release "GL" context if it is owned by window
+ // Mesa implementation can fail to destroy GL context if it set for current thread.
+ // It should be safer to unset thread GL context before its destruction.
#if defined(_WIN32)
HWND aWindow = (HWND )myGlContext->myWindow;
HDC aWindowDC = (HDC )myGlContext->myWindowDC;
HGLRC aWindowGContext = (HGLRC )myGlContext->myGContext;
#if defined(_WIN32)
HWND aWindow = (HWND )myGlContext->myWindow;
HDC aWindowDC = (HDC )myGlContext->myWindowDC;
HGLRC aWindowGContext = (HGLRC )myGlContext->myGContext;
- HGLRC aThreadG
lContext
= wglGetCurrentContext();
+ HGLRC aThreadG
Context
= wglGetCurrentContext();
myGlContext.Nullify();
myGlContext.Nullify();
- if (aThreadG
l
Context != NULL)
+ if (aThreadGContext != NULL)
{
{
- // Mesa implementation can fail to reset this thread's context if wglDeleteContext()
- // called without this step. This might lead to crash when using newly created
- // context if wglMakeCurrent() is not forced right after the wglCreateContext().
- if (aThreadGlContext == aWindowGContext)
+ if (aThreadGContext == aWindowGContext)
{
wglMakeCurrent (NULL, NULL);
}
{
wglMakeCurrent (NULL, NULL);
}
@@
-613,15
+612,21
@@
OpenGl_Window::~OpenGl_Window()
}
ReleaseDC (aWindow, aWindowDC);
#else
}
ReleaseDC (aWindow, aWindowDC);
#else
- Display* aDisplay = (Display* )myGlContext->myDisplay;
- GLXContext aGContext = (GLXContext )myGlContext->myGContext;
+ Display* aDisplay = (Display* )myGlContext->myDisplay;
+ GLXContext aWindowGContext = (GLXContext )myGlContext->myGContext;
+ GLXContext aThreadGContext = glXGetCurrentContext();
myGlContext.Nullify();
if (aDisplay != NULL)
{
myGlContext.Nullify();
if (aDisplay != NULL)
{
+ if (aThreadGContext == aWindowGContext)
+ {
+ glXMakeCurrent (aDisplay, None, NULL);
+ }
+
// FSXXX sync necessary if non-direct rendering
glXWaitGL();
// FSXXX sync necessary if non-direct rendering
glXWaitGL();
- glXDestroyContext (aDisplay, aGContext);
+ glXDestroyContext (aDisplay, a
Window
GContext);
}
#endif
}
}
#endif
}