From cc68474a7802453bd4ddd07bbfabba77aa27aae9 Mon Sep 17 00:00:00 2001 From: Yimgo Date: Fri, 3 Aug 2012 15:43:25 +0200 Subject: [PATCH] Segfault when quitting after tool widget deletion fixed. Fix is obvious but it probably hides something. --- src/frameworks/UBCoreGraphicsScene.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index 00c77ebb..8c526a65 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -32,7 +32,7 @@ UBCoreGraphicsScene::~UBCoreGraphicsScene() //we must delete removed items that are no more in any scene foreach (const QGraphicsItem* item, mItemsToDelete) { - if (item->scene()==NULL || item->scene() == this) + if (item && (item->scene() == NULL || item->scene() == this)) { delete item; } @@ -61,6 +61,7 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) { mItemsToDelete.remove(item); delete item; + item = 0; } } @@ -84,6 +85,7 @@ bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item) mItemsToDelete.remove(item); delete item; + item = 0; return true; } else