diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2012-03-19 14:55:12 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-19 17:08:42 +0100 |
commit | 590194331e3f8e2c6d8fd001ee36cf0ce7f55b3e (patch) | |
tree | 5e44aea33acb3bd82ac62eac67e339279fe48ec5 /src | |
parent | 3a3515b5a7f5d41fe79a53f162b69f58aca9731d (diff) |
Fix possible crash in QSGContext::invalidate()
In some cases QSGContext::invalidate() was called without any current
GL context when the render thread was terminated.
Change-Id: Ia5295c89fe13f2473115c736e328e386d6d4d183
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickwindowmanager.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 64eb2bf53b..61c2ef24b4 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -228,7 +228,7 @@ public slots: private: void handleAddedWindows(); void handleAddedWindow(QQuickCanvas *canvas); - void handleRemovedWindows(); + void handleRemovedWindows(bool clearGLContext = true); QSGContext *sg; QOpenGLContext *gl; @@ -475,7 +475,7 @@ void QQuickRenderThreadSingleContextWindowManager::hide(QQuickCanvas *canvas) /*! Called on Render Thread */ -void QQuickRenderThreadSingleContextWindowManager::handleRemovedWindows() +void QQuickRenderThreadSingleContextWindowManager::handleRemovedWindows(bool clearGLContext) { #ifdef THREAD_DEBUG printf(" RenderThread: about to remove %d\n", m_removed_windows.size()); @@ -496,7 +496,7 @@ void QQuickRenderThreadSingleContextWindowManager::handleRemovedWindows() // If a window is removed because it has been hidden it will take with it // the gl context (at least on Mac) if bound, so disconnect the gl context // from anything - if (removedAnything) + if (removedAnything && clearGLContext) gl->doneCurrent(); } @@ -755,7 +755,7 @@ void QQuickRenderThreadSingleContextWindowManager::run() #endif m_removed_windows << m_rendered_windows.keys(); - handleRemovedWindows(); + handleRemovedWindows(false); sg->invalidate(); |