Commit a75f87cd authored by Dmitry Kazakov's avatar Dmitry Kazakov

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.
parent 597d28b1
...@@ -190,7 +190,7 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) ...@@ -190,7 +190,7 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command)
const KisSavedMacroCommand *other = const KisSavedMacroCommand *other =
dynamic_cast<const KisSavedMacroCommand*>(command); dynamic_cast<const KisSavedMacroCommand*>(command);
if (!other || other->id() != id()) return false; if (!other || other->id() != id() || id() < 0 || other->id() < 0) return false;
QVector<Private::SavedCommand> &otherCommands = other->m_d->commands; QVector<Private::SavedCommand> &otherCommands = other->m_d->commands;
...@@ -203,7 +203,11 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) ...@@ -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; return true;
} }
...@@ -217,7 +221,9 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) ...@@ -217,7 +221,9 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command)
bool sameCommands = true; bool sameCommands = true;
while (it != end && otherIt != otherEnd) { 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->sequentiality != otherIt->sequentiality ||
it->exclusivity != otherIt->exclusivity) { it->exclusivity != otherIt->exclusivity) {
...@@ -242,6 +248,12 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command) ...@@ -242,6 +248,12 @@ bool KisSavedMacroCommand::mergeWith(const KUndo2Command* command)
++otherIt; ++otherIt;
} }
if (other->extraData()) {
setExtraData(other->extraData()->clone());
} else {
setExtraData(0);
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment