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,8 +120,12 @@ void UBGraphicsItemUndoCommand::undo()
{
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (polygonItem)
{
mScene->removeItem(polygonItem);
mScene->removeItemFromDeletion(polygonItem);
polygonItem->strokesGroup()->addToGroup(polygonItem);
}
}
UBApplication::boardController->freezeW3CWidget(item, false);
}
@ -225,9 +229,13 @@ void UBGraphicsItemUndoCommand::redo()
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if (polygonItem)
{
mScene->removeItem(polygonItem);
mScene->removeItemFromDeletion(polygonItem);
polygonItem->strokesGroup()->addToGroup(polygonItem);
}
}
}
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2) to trigger repaint
mScene->update(mScene->sceneRect());

@ -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
mRemovedItems << intersectedPolygonItem;
intersectedPolygonItem->strokesGroup()->removeFromGroup(intersectedPolygonItem);
removeItem(intersectedPolygonItem);
}

Loading…
Cancel
Save