Fixed crashes after erasing some strokes and undo.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 4423b2c757
commit 873edd98bd
  1. 8
      src/domain/UBGraphicsItemUndoCommand.cpp
  2. 1
      src/domain/UBGraphicsScene.cpp

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

Loading…
Cancel
Save