diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-18 11:21:08 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-19 11:22:27 (GMT) |
commit | ed13768e7b0c2ccf30f3ba0c1260c70a8f7a8e76 (patch) | |
tree | cbdbdd7a79ec257baac143310cf503aa0f3d0840 /src | |
parent | 2053560922c37b68fa107417c0555a34492f70e5 (diff) | |
download | Qt-ed13768e7b0c2ccf30f3ba0c1260c70a8f7a8e76.zip Qt-ed13768e7b0c2ccf30f3ba0c1260c70a8f7a8e76.tar.gz Qt-ed13768e7b0c2ccf30f3ba0c1260c70a8f7a8e76.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
(cherry picked from commit b6070e9a069219e4049fcf017d6a160b80bf37b7)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 42089f5..e98d61c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4422,9 +4422,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) { |