summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index b4e19d1..39c41c4 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1392,7 +1392,8 @@ QGraphicsItem::~QGraphicsItem()
}
delete d_ptr->transformData;
- qt_dataStore()->data.remove(this);
+ if (QGraphicsItemCustomDataStore *dataStore = qt_dataStore())
+ dataStore->data.remove(this);
}
/*!
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 7b54a3b..7c1b97e 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -90,6 +90,8 @@ Q_DECLARE_METATYPE(QRectF)
#define COMPARE_REGIONS QTRY_COMPARE
#endif
+static QGraphicsRectItem staticItem; //QTBUG-7629, we should not crash at exit.
+
static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton)
{
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);