changeset 136:d66fcf2e0342

* Avoid null pointer dereference
author Chris Cannam
date Tue, 30 Nov 2010 13:50:58 +0000
parents 908a1fdeed6a
children a4044b4b3e35
files panner.cpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/panner.cpp	Tue Nov 30 13:08:18 2010 +0000
+++ b/panner.cpp	Tue Nov 30 13:50:58 2010 +0000
@@ -72,16 +72,16 @@
                    this, SLOT(slotSceneRectChanged(const QRectF &)));
     }
     QGraphicsView::setScene(s);
+    m_cache = QPixmap();
     if (scene()) {
         QRectF r = sceneRect();
         DEBUG << "scene rect: " << r << ", my rect " << rect() << endl;
         fit(r);
+        connect(scene(), SIGNAL(changed(const QList<QRectF> &)),
+                this, SLOT(slotSceneChanged(const QList<QRectF> &)));
+        connect(scene(), SIGNAL(sceneRectChanged(const QRectF &)),
+                this, SLOT(slotSceneRectChanged(const QRectF &)));
     }
-    m_cache = QPixmap();
-    connect(scene(), SIGNAL(changed(const QList<QRectF> &)),
-            this, SLOT(slotSceneChanged(const QList<QRectF> &)));
-    connect(scene(), SIGNAL(sceneRectChanged(const QRectF &)),
-            this, SLOT(slotSceneRectChanged(const QRectF &)));
 }
 
 void