From 7ad3ba2dbb396552d062c9d6d75697150bee75da Mon Sep 17 00:00:00 2001
From: Lars Knoll <lars.knoll@digia.com>
Date: Fri, 13 Sep 2013 12:49:46 +0200
Subject: [PATCH] Don't polish items if the screen is 0

The current code leads to an assertion during qapp
destruction time, as the screen gets set to 0, which
triggers a force polish that in turns accesses the qapp instance.

In addition, we don't need to do any work when the screen is 0,
as the window can't be visble in that case. Once it gets visible
again, forcePolish() will be called again.

Change-Id: I81d9a11e494b4573a56d06bca651cc6b5fa785c7
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
---
 src/quick/items/qquickwindow.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index c99865e331..5b4145e235 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -298,6 +298,8 @@ void forcePolishHelper(QQuickItem *item)
 void QQuickWindow::forcePolish()
 {
     Q_D(QQuickWindow);
+    if (!screen())
+        return;
     forcePolishHelper(d->contentItem);
 }
 
-- 
GitLab