From a75f87cd8316e81c4de0f999c0f2f12dd8590bf4 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Fri, 2 Aug 2019 11:59:37 +0300 Subject: [PATCH] Fix continued transform in the new version of Transform Tool We should ensure that commands with id < 0 are not merged. Otherwise transform operations of different origin will be merged, although we didn't expect it. --- libs/image/commands_new/kis_saved_commands.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libs/image/commands_new/kis_saved_commands.cpp b/libs/image/commands_new/kis_saved_commands.cpp index ddec094bd9..b6e04b57a5 100644 --- a/libs/image/commands_new/kis_saved_commands.cpp +++ b/libs/image/commands_new/kis_saved_commands.cpp @@ -190,7 +190,7 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) const KisSavedMacroCommand *other = dynamic_cast(command); - if (!other || other->id() != id()) return false; + if (!other || other->id() != id() || id() < 0 || other->id() < 0) return false; QVector &otherCommands = other->m_d->commands; @@ -203,7 +203,11 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) } } - setExtraData(other->extraData()->clone()); + if (other->extraData()) { + setExtraData(other->extraData()->clone()); + } else { + setExtraData(0); + } return true; } @@ -217,7 +221,9 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) bool sameCommands = true; while (it != end && otherIt != otherEnd) { - if (it->command->id() != otherIt->command->id() || + if (it->command->id() < 0 || + otherIt->command->id() < 0 || + it->command->id() != otherIt->command->id() || it->sequentiality != otherIt->sequentiality || it->exclusivity != otherIt->exclusivity) { @@ -242,6 +248,12 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) ++otherIt; } + if (other->extraData()) { + setExtraData(other->extraData()->clone()); + } else { + setExtraData(0); + } + return true; } -- 2.24.0