Commit 873edd98 authored by Aleksei Kanash's avatar Aleksei Kanash

Fixed crashes after erasing some strokes and undo.

parent 4423b2c7
...@@ -120,7 +120,11 @@ void UBGraphicsItemUndoCommand::undo() ...@@ -120,7 +120,11 @@ void UBGraphicsItemUndoCommand::undo()
{ {
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (polygonItem) if (polygonItem)
{
mScene->removeItem(polygonItem);
mScene->removeItemFromDeletion(polygonItem);
polygonItem->strokesGroup()->addToGroup(polygonItem); polygonItem->strokesGroup()->addToGroup(polygonItem);
}
} }
UBApplication::boardController->freezeW3CWidget(item, false); UBApplication::boardController->freezeW3CWidget(item, false);
...@@ -225,7 +229,11 @@ void UBGraphicsItemUndoCommand::redo() ...@@ -225,7 +229,11 @@ void UBGraphicsItemUndoCommand::redo()
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (polygonItem) if (polygonItem)
{
mScene->removeItem(polygonItem);
mScene->removeItemFromDeletion(polygonItem);
polygonItem->strokesGroup()->addToGroup(polygonItem); polygonItem->strokesGroup()->addToGroup(polygonItem);
}
} }
} }
......
...@@ -843,6 +843,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) ...@@ -843,6 +843,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
//remove full polygon item for replace it by couple of polygons who creates the same stroke without a part which intersects with eraser //remove full polygon item for replace it by couple of polygons who creates the same stroke without a part which intersects with eraser
mRemovedItems << intersectedPolygonItem; mRemovedItems << intersectedPolygonItem;
intersectedPolygonItem->strokesGroup()->removeFromGroup(intersectedPolygonItem);
removeItem(intersectedPolygonItem); removeItem(intersectedPolygonItem);
} }
......
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