Commit: 1d8739b014322ddb6a7a5d5cdb911869d3aac69b
Author: Jason Wilkins
Date:   Thu Jul 10 17:59:56 2014 -0500
https://developer.blender.org/rB1d8739b014322ddb6a7a5d5cdb911869d3aac69b

need to call releaseNativeHandles in GHOST_WindowX11's destructor, as well as 
some additional checks in GHOST_ContextGLX's destructor

===================================================================

M       intern/ghost/intern/GHOST_ContextGLX.cpp
M       intern/ghost/intern/GHOST_WindowX11.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp 
b/intern/ghost/intern/GHOST_ContextGLX.cpp
index c05177d..110124c 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -79,21 +79,23 @@ GHOST_ContextGLX::GHOST_ContextGLX(
 
 GHOST_ContextGLX::~GHOST_ContextGLX()
 {
-       if (m_context != NULL) {
+       if (m_display != NULL) {
                activateGLXEW();
 
-               if (m_context == ::glXGetCurrentContext())
-                       ::glXMakeCurrent(m_display, m_window, NULL);
+               if (m_context != None) {
+                       if (m_window != 0 && m_context == 
::glXGetCurrentContext())
+                               ::glXMakeCurrent(m_display, m_window, NULL);
 
-               if (m_context != s_sharedContext || s_sharedCount == 1) {
-                       assert(s_sharedCount > 0);
+                       if (m_context != s_sharedContext || s_sharedCount == 1) 
{
+                               assert(s_sharedCount > 0);
 
-                       s_sharedCount--;
+                               s_sharedCount--;
 
-                       if (s_sharedCount == 0)
-                               s_sharedContext = NULL;
+                               if (s_sharedCount == 0)
+                                       s_sharedContext = NULL;
 
-                       ::glXDestroyContext(m_display, m_context);
+                               ::glXDestroyContext(m_display, m_context);
+                       }
                }
 
                delete m_glxewContext;
@@ -297,8 +299,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 
 GHOST_TSuccess GHOST_ContextGLX::releaseNativeHandles()
 {
-       m_window  = 0;
-       m_display = NULL;
+       m_window = 0;
 
        return GHOST_kSuccess;
 }
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp 
b/intern/ghost/intern/GHOST_WindowX11.cpp
index fbdd0f7..ade76f2 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1077,6 +1077,8 @@ GHOST_WindowX11::
        delete m_dropTarget;
 #endif
 
+       releaseNativeHandles();
+
        XDestroyWindow(m_display, m_window);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to