[graphics/krita/krita/6.0] libs/flake/commands: Fix subpath deletion failing sometimes
Dmitry Kazakov <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 61aa0c751573866dbc1ef0e8d2e96e245441ec53 by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 27/07/2026 at 11:38.
Pushed by dkazakov into branch 'krita/6.0'.
Fix subpath deletion failing sometimes
Before this commit sometimes some subpaths would fail to be deleted due
to subpath indices shifting when being deleted
BUG:523081
M +6 -0 libs/flake/commands/KoPathPointRemoveCommand.cpp
https://invent.kde.org/graphics/krita/-/commit/61aa0c751573866dbc1ef0e8d2e96e245441ec53
diff --git a/libs/flake/commands/KoPathPointRemoveCommand.cpp b/libs/flake/commands/KoPathPointRemoveCommand.cpp
index d2b086a8b43..10340d8571d 100644
--- a/libs/flake/commands/KoPathPointRemoveCommand.cpp
+++ b/libs/flake/commands/KoPathPointRemoveCommand.cpp
@@ -93,6 +93,12 @@ KUndo2Command *KoPathPointRemoveCommand::createCommand(
if (pointsToDelete.size() > 0) {
new KoPathPointRemoveCommand(pointsToDelete, cmd);
}
+
+ //Reverse sort the subpath list to account for shifting indices of the subpaths
+ std::sort(subpathToDelete.begin(), subpathToDelete.end(), [](KoPathPointData a, KoPathPointData b) {
+ return a.pointIndex > b.pointIndex;
+ });
+
Q_FOREACH (const KoPathPointData & pd, subpathToDelete) {
new KoSubpathRemoveCommand(pd.pathShape, pd.pointIndex.first, cmd);
}