SANKORE-332 / SANKORE-300 : fix crash

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent c4cefa677e
commit 6473d4fa0f
  1. 4
      src/board/UBBoardController.cpp
  2. 13
      src/frameworks/UBCoreGraphicsScene.cpp
  3. 3
      src/frameworks/UBCoreGraphicsScene.h

@ -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)
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
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;
}; };

Loading…
Cancel
Save