[NEEDS TESTING] Fix assert and a data-loss in Transform Tool
The patch rewrites the logic of transform stroke completion. Previously, the decision whether to cancel transformation or to recover continued state was done by the GUI thread. It cased troubles, because the user could press esc/enter keys too quickly, even before the stroke was actually initialized (and before sigTransactionGenerated() was received). It caused confsion, resulting in the loss of the data of the continued state.
Now GUI thread doesn't worry about the continued state. All the decisions are done by the stroke itself, so no races should happen.
Test Plan
- Transform your image somehow
- Apply this transform.
- Now just start randomly, concurrently and very quickly: a) click+drag on the canvas with mouse button to activate transform (or transform it) b) press esc key c) press enter key d) click on some buttons in the tool options
All these crazy actions should not cause any crashes or data-losses
- Check is "continued transform" still works in an expected way: two consecutive transforms should be merged, unless you explicitly press esc-key or reset button.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.