[graphics/krita] libs/flake/commands: Fix subpath deletion failing sometimes
Dmitry Kazakov <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 329d8714c652a9c3a519e240a9c835fd9aebeef6 by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 27/07/2026 at 11:11.
Pushed by dkazakov into branch 'master'.
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/329d8714c652a9c3a519e240a9c835fd9aebeef6
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);
}