Commit 2dc2ed5f authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix a crash when cancelling Transform Tool action

The crash happens only on systems that have asserts enabled, that
is, don't have NDEBUG defined.

Binding uninitialized '*m_savedTransformArgs' to a cont-reference
generated valid c++ code (a reference initialized with nullptr),
and given that finishStrokeImpl() didn't try to use/dereference
this reference, the code worked fine and didn't crash on systems
without asserts.

But on systems with asserts enabled (non NDEBUG), boost::optional
triggered a sanity check assert for dereferencing nullptr and crashed
the application.

The patch removes entire code for resetting m_savedTransformArgs in
cancelStrokeCallback(). It was actually an artifact of some initial

Thanks Fredrik Hansson for pointing out the problem!

parent 2771cd99
......@@ -706,12 +706,5 @@ void TransformStrokeStrategy::finishStrokeCallback()
void TransformStrokeStrategy::cancelStrokeCallback()
const bool shouldRecoverSavedInitialState =
if (shouldRecoverSavedInitialState) {
m_savedTransformArgs = m_initialTransformArgs;
finishStrokeImpl(shouldRecoverSavedInitialState, *m_savedTransformArgs);
finishStrokeImpl(!m_initialTransformArgs.isIdentity(), m_initialTransformArgs);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment