Don't crash if there's no m_image yet.
authorSérgio Martins <sergio.martins@kdab.com>
Sun, 21 Oct 2012 23:55:04 +0000 (00:55 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 25 Oct 2012 12:10:04 +0000 (14:10 +0200)
Reproducible with:
    QBackingStore store( &window );
    store.beginPaint(QRect(0,0,500,500));

All other methods already have null pointer checks.

Change-Id: Ie278a263760900b58cf4a2ef286deb7f35d50cd0
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
src/plugins/platforms/xcb/qxcbbackingstore.cpp

index 847fd67..649469a 100644 (file)
@@ -262,11 +262,14 @@ QXcbBackingStore::~QXcbBackingStore()
 
 QPaintDevice *QXcbBackingStore::paintDevice()
 {
-    return m_image->image();
+    return m_image ? m_image->image() : 0;
 }
 
 void QXcbBackingStore::beginPaint(const QRegion &region)
 {
+    if (!m_image)
+        return;
+
     m_image->preparePaint(region);
 
 #if 0