Commit 6473d4fa authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

SANKORE-332 / SANKORE-300 : fix crash

parent c4cefa67
...@@ -1212,7 +1212,9 @@ void UBBoardController::ClearUndoStack() ...@@ -1212,7 +1212,9 @@ void UBBoardController::ClearUndoStack()
QGraphicsItem* item = itUniq.next(); QGraphicsItem* item = itUniq.next();
UBGraphicsScene *scene = (UBGraphicsScene*)item->scene(); UBGraphicsScene *scene = (UBGraphicsScene*)item->scene();
if(!scene) if(!scene)
delete item; {
bool retCode = mActiveScene->deleteItem(item);
}
} }
} }
......
...@@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) ...@@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete)
delete item; delete item;
} }
} }
bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item)
{
if(mItemsToDelete.contains(item))
{
mItemsToDelete.remove(item);
delete item;
return true;
}
else
return false;
}
...@@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene ...@@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene
virtual void removeItem(QGraphicsItem* item, bool forceDelete = false); virtual void removeItem(QGraphicsItem* item, bool forceDelete = false);
virtual bool deleteItem(QGraphicsItem* item);
private: private:
QSet<QGraphicsItem*> mItemsToDelete; QSet<QGraphicsItem*> mItemsToDelete;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment