summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-18 11:21:08 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-18 11:35:32 (GMT)
commitb6070e9a069219e4049fcf017d6a160b80bf37b7 (patch)
tree0e0c5a3164888b981d10e6f61ee78294383a3e58 /src/gui
parent1dacf83b2c957d320e65335cfc5f9abfda94b7c0 (diff)
downloadQt-b6070e9a069219e4049fcf017d6a160b80bf37b7.zip
Qt-b6070e9a069219e4049fcf017d6a160b80bf37b7.tar.gz
Qt-b6070e9a069219e4049fcf017d6a160b80bf37b7.tar.bz2
Crash when rendering a scene using DeviceCoordinateCache
The execution flow would allow the widget the scene would be rendered on to be null. However this very widget was being used when using DeviceCoordinateCache to get the desktop size. We now skip this optimisation when no widget is given. Auto-test included. Reviewed-by: bnilsen Task-number: QTBUG-5904
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index a463c01..10d251d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4420,9 +4420,12 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
bool allowPartialCacheExposure = !viewRect.contains(deviceRect);
#else
// Only if deviceRect is 20% taller or wider than the desktop.
- QRect desktopRect = QApplication::desktop()->availableGeometry(widget);
- bool allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width()
- || desktopRect.height() * 1.2 < deviceRect.height());
+ bool allowPartialCacheExposure = false;
+ if (widget) {
+ QRect desktopRect = QApplication::desktop()->availableGeometry(widget);
+ allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width()
+ || desktopRect.height() * 1.2 < deviceRect.height());
+ }
#endif
QRegion scrollExposure;
if (deviceData->cacheIndent != QPoint() || allowPartialCacheExposure) {