Prevent crash when doing threaded rendering of multiple windows.
authorSamuel Rødal <samuel.rodal@digia.com>
Wed, 7 Nov 2012 16:03:07 +0000 (17:03 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 8 Nov 2012 12:15:35 +0000 (13:15 +0100)
Don't call renderSceneGraph() on non-renderable windows. We also don't
call syncSceneGraph() on them, which is where the renderer will be set.

Also get rid of harmless warning about non-renderable windows.

Change-Id: I24739abefe0d554efb568514057719f981590c28
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
src/quick/items/qquickthreadedwindowmanager.cpp
src/quick/items/qquickthreadedwindowmanager_p.h

index fac4fb0..4c38686 100644 (file)
@@ -184,6 +184,7 @@ void QQuickRenderThreadSingleContextWindowManager::handleAddedWindow(QQuickWindo
     data->sizeWasChanged = false;
     data->windowSize = window->size();
     data->isVisible = window->isVisible();
+    data->isRenderable = QQuickWindowPrivate::get(window)->isRenderable();
     m_rendered_windows[window] = data;
 
     isExternalUpdatePending = true;
@@ -397,7 +398,9 @@ void QQuickRenderThreadSingleContextWindowManager::run()
             WindowData *windowData = it.value();
             QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window);
 
-            if (windowPrivate->isRenderable()) {
+            windowData->isRenderable = windowPrivate->isRenderable();
+
+            if (windowData->isRenderable) {
                 gl->makeCurrent(window);
 
                 if (windowData->viewportSize != windowData->windowSize) {
@@ -410,10 +413,6 @@ void QQuickRenderThreadSingleContextWindowManager::run()
                 }
 
                 windowPrivate->syncSceneGraph();
-            } else {
-                qWarning().nospace()
-                    << "Non-renderable window " << window
-                    << " (" << window->geometry() << ").";
             }
         }
         inSync = false;
@@ -435,6 +434,9 @@ void QQuickRenderThreadSingleContextWindowManager::run()
             WindowData *windowData = it.value();
             QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window);
 
+            if (!windowData->isRenderable)
+                continue;
+
 #ifdef THREAD_DEBUG
             printf("                RenderThread: Rendering window %p\n", window);
 #endif
index 9e28d87..b71620f 100644 (file)
@@ -159,6 +159,7 @@ private:
 
         uint sizeWasChanged : 1;
         uint isVisible : 1;
+        uint isRenderable : 1;
     };
 
     QHash<QQuickWindow *, WindowData *> m_rendered_windows;