Stop render thread regardless when the window is being destroyed
authorGunnar Sletta <gunnar.sletta@digia.com>
Mon, 25 Nov 2013 10:40:12 +0000 (11:40 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 25 Nov 2013 16:32:51 +0000 (17:32 +0100)
When a window is shown and quickly hidden again we can get to
a state, on a asynchronous windowing system API, where the
isExposed=true event has been pushed to the event queue but
not yet processed at the time the user calls hide().
As hide() immediately sets isVisible() to false, we end up with
isExposed=true and isVisible=false which prevent the WM_Obscure
event to be sent to render loop which means the render thread
thought the window was still on screen when we reched the
shutdown in WM_TryRelease.

Changed WM_TryRelease handling to disregard window state when
the window is being deleted. This forces SG and GL cleanup
and stops the thread.

Task-number: QTBUG-35055
Change-Id: Ibac5aa27354d6450f30a61450214cb785ab855bf
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quick/scenegraph/qsgthreadedrenderloop.cpp

index bca7736..850a463 100644 (file)
@@ -402,8 +402,8 @@ bool QSGRenderThread::event(QEvent *e)
     case WM_TryRelease: {
         QSG_RT_DEBUG("WM_TryRelease");
         mutex.lock();
-        if (!window) {
-            WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e);
+        WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e);
+        if (!window || wme->inDestructor) {
             QSG_RT_DEBUG(" - setting exit flag and invalidating GL");
             invalidateOpenGL(wme->window, wme->inDestructor);
             active = gl;