Bug 409275 - Following Bug #408593, quick duplicating and moving layers now causes hanging
Summary: Following Bug #408593, quick duplicating and moving layers now causes hanging
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: 4.2.2
Platform: Appimage Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
: 408826 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-28 10:43 UTC by Paolo Puggioni
Modified: 2019-07-31 08:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Quick video of the bug (2.70 MB, video/mp4)
2019-06-28 10:43 UTC, Paolo Puggioni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Puggioni 2019-06-28 10:43:11 UTC
Created attachment 121199 [details]
Quick video of the bug

SUMMARY

This behaviour started to appear in v.4.2. As soon as I tried the new version I tried to duplicate and move layers to double check bug 408593 had been fixed.
Now, instead of having a short freeze after the Duplicate action, I get a "waiting for image operation to complete" that hangs indefinitely, so much so that Krita has to be force terminated.


STEPS TO REPRODUCE
1. create new image. 
2. Add new layer
3. CTRL+J to duplicate layer
4. move layer with Move tool
5. repeat step 3 and 4

OBSERVED RESULT

Message "waiting for image operation to complete" pops up and application hangs indefinitely.

EXPECTED RESULT

Newly duplicated layer can be moved

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Opensuse Leap 15.0
(available in About System)
KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.45.0
Qt Version: 5.9.4

ADDITIONAL INFORMATION

It's less likely to occur on smaller images. The image in the video attached is 7000x7000x720dpi
Comment 1 Halla Rempt 2019-06-28 10:45:05 UTC
Assigning to Dmitry
Comment 2 Dmitry Kazakov 2019-07-30 15:32:05 UTC
Git commit 21889437905f05266092c854beb3282dd5f4b7a4 by Dmitry Kazakov.
Committed on 30/07/2019 at 14:16.
Pushed by dkazakov into branch 'master'.

Make Move Tool asynchronous

Calling blockUntilOperationsFinished() from tool event handler makes
KisShortcutMatcher to be entered recursively. It basically breaks events
flow and makes KisShortcutMatcher crazy.

I tried to move blocking into the shortcuts matcher itself (so that
it could treat recursive entrance correctly), but it doesn't handle
special cases like KisToolTransform::activate(), which should also
block (if we keep them blocking).

M  +9    -1    libs/ui/tool/strokes/move_stroke_strategy.cpp
M  +6    -1    libs/ui/tool/strokes/move_stroke_strategy.h
M  +1    -0    plugins/tools/basictools/CMakeLists.txt
A  +60   -0    plugins/tools/basictools/KisMoveBoundsCalculationJob.cpp     [License: GPL (v2+)]
A  +46   -0    plugins/tools/basictools/KisMoveBoundsCalculationJob.h     [License: GPL (v2+)]
M  +54   -38   plugins/tools/basictools/kis_tool_move.cc
M  +4    -1    plugins/tools/basictools/kis_tool_move.h
M  +4    -1    plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp
M  +8    -1    plugins/tools/basictools/strokes/move_selection_stroke_strategy.h

https://invent.kde.org/kde/krita/commit/21889437905f05266092c854beb3282dd5f4b7a4
Comment 3 Dmitry Kazakov 2019-07-30 15:32:06 UTC
Git commit 008503fb5c5590cfe74c73c1e1a76b26a944e309 by Dmitry Kazakov.
Committed on 30/07/2019 at 14:16.
Pushed by dkazakov into branch 'master'.

Make shape painting tools unblocking (use strokes)

Opening a waiting dialog may make the shortcuts matcher unhappy,
so we should avoid that.
Related: bug 409968, bug 408826

M  +3    -4    libs/ui/tool/kis_tool_shape.cc
M  +1    -2    plugins/tools/basictools/kis_tool_ellipse.cc
M  +42   -25   plugins/tools/basictools/kis_tool_gradient.cc
M  +1    -3    plugins/tools/basictools/kis_tool_rectangle.cc
M  +0    -2    plugins/tools/tool_polygon/kis_tool_polygon.cc
M  +0    -3    plugins/tools/tool_polyline/kis_tool_polyline.cc

https://invent.kde.org/kde/krita/commit/008503fb5c5590cfe74c73c1e1a76b26a944e309
Comment 4 Dmitry Kazakov 2019-07-30 15:32:53 UTC
The bug is now fixed in 

https://invent.kde.org/kde/krita/commit/21889437905f05266092c854beb3282dd5f4b7a4
Comment 5 Dmitry Kazakov 2019-07-30 15:33:19 UTC
*** Bug 408826 has been marked as a duplicate of this bug. ***
Comment 6 Halla Rempt 2019-07-31 08:42:11 UTC
Git commit d6f28168520f376a0c35b7c38f6590f48023d3e0 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make Move Tool asynchronous

Calling blockUntilOperationsFinished() from tool event handler makes
KisShortcutMatcher to be entered recursively. It basically breaks events
flow and makes KisShortcutMatcher crazy.

I tried to move blocking into the shortcuts matcher itself (so that
it could treat recursive entrance correctly), but it doesn't handle
special cases like KisToolTransform::activate(), which should also
block (if we keep them blocking).

M  +9    -1    libs/ui/tool/strokes/move_stroke_strategy.cpp
M  +6    -1    libs/ui/tool/strokes/move_stroke_strategy.h
M  +1    -0    plugins/tools/basictools/CMakeLists.txt
A  +60   -0    plugins/tools/basictools/KisMoveBoundsCalculationJob.cpp     [License: GPL (v2+)]
A  +46   -0    plugins/tools/basictools/KisMoveBoundsCalculationJob.h     [License: GPL (v2+)]
M  +54   -38   plugins/tools/basictools/kis_tool_move.cc
M  +4    -1    plugins/tools/basictools/kis_tool_move.h
M  +4    -1    plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp
M  +8    -1    plugins/tools/basictools/strokes/move_selection_stroke_strategy.h

https://invent.kde.org/kde/krita/commit/d6f28168520f376a0c35b7c38f6590f48023d3e0
Comment 7 Halla Rempt 2019-07-31 08:42:11 UTC
Git commit c9ed22b11d794d5c81e04a42e8b271bc041f4a36 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make KisToolTransform fully asynchronous

Now all initialization of the transform tool has been moved into the
stroke's context. It means that the tool doesn't need to block event
loop until it image is finished anymore.

The fix uses he new features of the strokes framework, specifically
mutated stroke jobs.

M  +2    -1    libs/command/kis_command_ids.h
M  +1    -0    libs/command/kundo2commandextradata.h
M  +1    -0    libs/image/CMakeLists.txt
A  +80   -0    libs/image/commands_new/KisHoldUIUpdatesCommand.cpp     [License: GPL (v2+)]
C  +19   -7    libs/image/commands_new/KisHoldUIUpdatesCommand.h [from: libs/command/kundo2commandextradata.h - 051% similarity]
M  +40   -10   libs/image/commands_new/kis_saved_commands.cpp
M  +4    -0    libs/image/commands_new/kis_saved_commands.h
M  +4    -0    libs/image/kis_crop_saved_extra_data.h
M  +20   -0    libs/image/kis_image.cc
M  +29   -0    libs/image/kis_image.h
M  +7    -0    libs/image/kis_image_interfaces.h
M  +20   -5    libs/image/kis_stroke_strategy_undo_command_based.cpp
M  +23   -1    libs/image/kis_stroke_strategy_undo_command_based.h
M  +62   -249  plugins/tools/tool_transform2/kis_tool_transform.cc
M  +4    -32   plugins/tools/tool_transform2/kis_tool_transform.h
M  +1    -32   plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
M  +93   -0    plugins/tools/tool_transform2/kis_transform_utils.cpp
M  +12   -0    plugins/tools/tool_transform2/kis_transform_utils.h
M  +222  -14   plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp
M  +41   -6    plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
M  +18   -7    plugins/tools/tool_transform2/transform_transaction_properties.h

https://invent.kde.org/kde/krita/commit/c9ed22b11d794d5c81e04a42e8b271bc041f4a36
Comment 8 Halla Rempt 2019-07-31 08:42:12 UTC
Git commit df7f7a9ac7e49a44ef83062c19a3d62510a0ad49 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make shape painting tools unblocking (use strokes)

Opening a waiting dialog may make the shortcuts matcher unhappy,
so we should avoid that.
Related: bug 409968, bug 408826

M  +3    -4    libs/ui/tool/kis_tool_shape.cc
M  +1    -2    plugins/tools/basictools/kis_tool_ellipse.cc
M  +42   -25   plugins/tools/basictools/kis_tool_gradient.cc
M  +1    -3    plugins/tools/basictools/kis_tool_rectangle.cc
M  +0    -2    plugins/tools/tool_polygon/kis_tool_polygon.cc
M  +0    -3    plugins/tools/tool_polyline/kis_tool_polyline.cc

https://invent.kde.org/kde/krita/commit/df7f7a9ac7e49a44ef83062c19a3d62510a0ad49
Comment 9 Halla Rempt 2019-07-31 08:42:12 UTC
Git commit dc6bf17a96556c930f63e4cfbd42591f79987573 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make KisShortcutMatcher be more tolerant to recursive entering

Some tools, e.g. text tool, may open a dialog right inside
beginPrimaryAction() callback. It may make KisShortcutMatcher crazy,
because all the modal dialogs have hey own event loop, therefore
the state machine of the shortcuts matcher will be broken.

This patch makes the matcher a bit more tolerant to such faults. It
just manually checks if it is entered more that once, and resets the
action in case a recursion is detected.
Related: bug 409968, bug 408826

M  +168  -30   libs/ui/input/kis_shortcut_matcher.cpp
M  +1    -0    libs/ui/input/kis_shortcut_matcher.h

https://invent.kde.org/kde/krita/commit/dc6bf17a96556c930f63e4cfbd42591f79987573