Change Q_ASSERTs in qquick[threaded]windowmanager.cpp to qWarning().
authorFriedemann Kleint <Friedemann.Kleint@digia.com>
Thu, 4 Oct 2012 10:15:49 +0000 (12:15 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 20 Oct 2012 07:04:19 +0000 (09:04 +0200)
As they also triggers when a non-existing file is loaded into QML2
or windows have invalid sizes.

Change-Id: Iab1ce6c99f2bc2cb360ddaccce539cb97979ad5a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
src/quick/items/qquickthreadedwindowmanager.cpp
src/quick/items/qquickwindowmanager.cpp

index 50bd569..fac4fb0 100644 (file)
@@ -43,6 +43,7 @@
 #include "qquickthreadedwindowmanager_p.h"
 
 #include <QtCore/QTime>
+#include <QtCore/QDebug>
 
 #include <QtGui/QOpenGLContext>
 #include <QtGui/private/qguiapplication_p.h>
@@ -396,20 +397,24 @@ void QQuickRenderThreadSingleContextWindowManager::run()
             WindowData *windowData = it.value();
             QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window);
 
-            Q_ASSERT(windowPrivate->isRenderable());
-
-            gl->makeCurrent(window);
+            if (windowPrivate->isRenderable()) {
+                gl->makeCurrent(window);
 
-            if (windowData->viewportSize != windowData->windowSize) {
+                if (windowData->viewportSize != windowData->windowSize) {
 #ifdef THREAD_DEBUG
-                printf("                RenderThread: --- window has changed size...\n");
+                    printf("                RenderThread: --- window has changed size...\n");
 #endif
-                windowData->viewportSize = windowData->windowSize;
-                windowData->sizeWasChanged = true;
-                glViewport(0, 0, windowData->viewportSize.width(), windowData->viewportSize.height());
-            }
+                    windowData->viewportSize = windowData->windowSize;
+                    windowData->sizeWasChanged = true;
+                    glViewport(0, 0, windowData->viewportSize.width(), windowData->viewportSize.height());
+                }
 
-            windowPrivate->syncSceneGraph();
+                windowPrivate->syncSceneGraph();
+            } else {
+                qWarning().nospace()
+                    << "Non-renderable window " << window
+                    << " (" << window->geometry() << ").";
+            }
         }
         inSync = false;
 
index dd27182..50887e8 100644 (file)
@@ -225,7 +225,13 @@ void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window)
     if (!masterWindow)
         return;
 
-    Q_ASSERT(QQuickWindowPrivate::get(masterWindow)->isRenderable());
+    if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) {
+        qWarning().nospace()
+            << "Unable to find a renderable master window "
+            << masterWindow << "when trying to render"
+            << window << " (" << window->geometry() << ").";
+        return;
+    }
 
     if (!gl) {
         gl = new QOpenGLContext();