Don't delete scene-graph atlas manager if it hasn't been created yet
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>
Tue, 1 Oct 2013 13:35:16 +0000 (15:35 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 2 Oct 2013 14:07:33 +0000 (16:07 +0200)
QSGContext::invalidate() is called from the QSGContext destructor,
but the atlas manager is only created if QSGContext::initialize()
is called, which may not always happen.

The result was a bunch of "QCoreApplication::postEvent: Unexpected
null receiver" messages during testing.

Change-Id: I11a294d48c06d687a9f82cf1ce825063cda8ecf6
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
src/quick/scenegraph/qsgcontext.cpp

index 8dc8cdc..f1c13a9 100644 (file)
@@ -234,8 +234,10 @@ void QSGContext::invalidate()
         QSGAtlasTexture::Texture, but this seemed simpler.
      */
 
-    d->atlasManager->deleteLater();
-    d->atlasManager = 0;
+    if (d->atlasManager) {
+        d->atlasManager->deleteLater();
+        d->atlasManager = 0;
+    }
 }