From 8076b428d2e6b8de8bacf556b8dccb5bbd99e0ac Mon Sep 17 00:00:00 2001 From: Taylor Braun-Jones Date: Thu, 31 Jul 2014 19:47:04 -0400 Subject: [PATCH] Don't try to reload QQuick images when changing to null screen When a QGuiApplication is destructing, a screen change occurs causing QQuickImageBase to reload images ultimately resulting in "QPixmap: Must construct a QGuiApplication before a QPixmap". This patch fixes the issue (except for systems which multiple screens, which is a separate issue). Task-number: QTBUG-40539 Change-Id: I4bafc9790741204e90190a4491ac7a9393d0d0a7 Reviewed-by: J-P Nurmi Reviewed-by: Gunnar Sletta --- src/quick/items/qquickimagebase.cpp | 4 ++-- src/quick/items/qquickimagebase_p.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index bf67cbe..738430d 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -292,10 +292,10 @@ void QQuickImageBase::handleWindowChanged(QQuickWindow* window) connect(window, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChanged(QScreen*))); } -void QQuickImageBase::handleScreenChanged(QScreen*) +void QQuickImageBase::handleScreenChanged(QScreen* screen) { // Screen DPI might have changed, reload images on screen change. - if (isComponentComplete()) + if (screen && isComponentComplete()) load(); } diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index 67f1e81..a3d9e3a 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -107,7 +107,7 @@ private Q_SLOTS: virtual void requestFinished(); void requestProgress(qint64,qint64); void handleWindowChanged(QQuickWindow *window); - void handleScreenChanged(QScreen *); + void handleScreenChanged(QScreen *screen); private: Q_DISABLE_COPY(QQuickImageBase) -- 2.7.4