fixed an issue where erase a stroke then clear the scene before changing page would cause a crash

preferencesAboutTextFull
Clément Fauconnier 4 years ago
parent 1cb97a8f85
commit b3692061a5
  1. 22
      src/board/UBBoardController.cpp
  2. 2
      src/board/UBBoardController.h

@ -1632,11 +1632,11 @@ void UBBoardController::moveSceneToIndex(int source, int target)
} }
} }
void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem*> &itms) void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem*> &items)
{ {
if (parent->childCount()) { if (parent->childCount()) {
for (int i = 0; i < parent->childCount(); i++) { for (int i = 0; i < parent->childCount(); i++) {
findUniquesItems(parent->child(i), itms); findUniquesItems(parent->child(i), items);
} }
} }
@ -1657,16 +1657,26 @@ void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet<QGraph
while (itAdded.hasNext()) while (itAdded.hasNext())
{ {
QGraphicsItem* item = itAdded.next(); QGraphicsItem* item = itAdded.next();
if( !itms.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type())) if (!items.contains(item) &&
itms.insert(item); !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()) &&
!items.contains(item->parentItem())
)
{
items.insert(item);
}
} }
QSetIterator<QGraphicsItem*> itRemoved(cmd->GetRemovedList()); QSetIterator<QGraphicsItem*> itRemoved(cmd->GetRemovedList());
while (itRemoved.hasNext()) while (itRemoved.hasNext())
{ {
QGraphicsItem* item = itRemoved.next(); QGraphicsItem* item = itRemoved.next();
if( !itms.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type())) if (!items.contains(item) &&
itms.insert(item); !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()) &&
!items.contains(item->parentItem())
)
{
items.insert(item);
}
} }
} }

@ -177,7 +177,7 @@ class UBBoardController : public UBDocumentContainer
void notifyPageChanged(); void notifyPageChanged();
void displayMetaData(QMap<QString, QString> metadatas); void displayMetaData(QMap<QString, QString> metadatas);
void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &itms); void findUniquesItems(const QUndoCommand *parent, QSet<QGraphicsItem *> &items);
void ClearUndoStack(); void ClearUndoStack();
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false, bool onImport = false); void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false, bool onImport = false);

Loading…
Cancel
Save