summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-09-13 12:23:04 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-09-13 13:17:01 (GMT)
commit548155fec3a8b575215625d4fd767e63c20f6b84 (patch)
treede72a03ef2705665bf9dee7a1b0ae8a469e1c651
parent0313095b876e86cee5a83a3147aa182e1f2061b8 (diff)
downloadQt-548155fec3a8b575215625d4fd767e63c20f6b84.zip
Qt-548155fec3a8b575215625d4fd767e63c20f6b84.tar.gz
Qt-548155fec3a8b575215625d4fd767e63c20f6b84.tar.bz2
Assertion calledEmitUpdated fails in QGraphicsScene.
Problem was that the 'updateAll' boolean was reset to 'false' when it really should have been unchanged. This happened when rendering the scene from outside the view's paint event (i.e. from QGraphicsView/Scene::render). We only want to reset 'updateAll' when triggering drawItems() from QGraphicsView::paintEvent, i.e. when the 'view' pointer != 0. Broke after commit: dda8a57c. Auto test included. Task-number: QT-3674
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp20
2 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 539685a..36a24db 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5270,7 +5270,6 @@ void QGraphicsScene::drawItems(QPainter *painter,
if (!d->unpolishedItems.isEmpty())
d->_q_polishItems();
- d->updateAll = false;
QTransform viewTransform = painter->worldTransform();
Q_UNUSED(options);
@@ -5279,6 +5278,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
QRegion *expose = 0;
const quint32 oldRectAdjust = d->rectAdjust;
if (view) {
+ d->updateAll = false;
expose = &view->d_func()->exposedRegion;
if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
d->rectAdjust = 1;
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index c145623..b8e729e 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -287,6 +287,7 @@ private slots:
void taskQTBUG_5904_crashWithDeviceCoordinateCache();
void taskQT657_paintIntoCacheWithTransparentParts();
void taskQTBUG_7863_paintIntoCacheWithTransparentParts();
+ void taskQT_3674_doNotCrash();
};
void tst_QGraphicsScene::initTestCase()
@@ -4565,6 +4566,25 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
}
}
+void tst_QGraphicsScene::taskQT_3674_doNotCrash()
+{
+ QGraphicsScene scene;
+
+ QGraphicsView view(&scene);
+ view.resize(200, 200);
+
+ QPixmap pixmap(view.size());
+ QPainter painter(&pixmap);
+ view.render(&painter);
+ painter.end();
+
+ scene.addItem(new QGraphicsWidget);
+ scene.setBackgroundBrush(Qt::green);
+
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
void tst_QGraphicsScene::zeroScale()
{
//should not crash