Bug 457715

Summary: Switching Transform preview mode sometimes causes Krita to hang
Product: [Applications] krita Reporter: tomtomtomreportingin
Component: Tools/TransformAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: tamtamy.tymona
Priority: NOR Keywords: triaged
Version First Reported In: 5.1.0-RC1   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description tomtomtomreportingin 2022-08-10 12:22:48 UTC
SUMMARY
If the user performs some number of transform operations on a certain transformation and then switches the Transform Tool's preview mode, the user might be faced with a "Waiting for image operations to complete..." popup that signals a hang. Sometimes closing this popup cancels the hang, but other times it doesn't.

The reproducability of this hang might depend on the size of the transform and the speed at which the transform operations are performed.

STEPS TO REPRODUCE
1. Create an A5 600 PPI document.
2. Draw a large circle.
3. Perform some number of free transform actions including translations and resizings.
4. Switch Preview modes during the tranform operations.

OBSERVED RESULT
"Waiting for image operations to complete..." pops up and no further actions can be taken even after closing the popup.

EXPECTED RESULT
No hang after switching preview modes.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.96.0
Qt Version: 5.12.12 (appimage)
Comment 1 Tiar 2022-08-10 13:41:28 UTC
It seems like Transform Tool accepts the transformation when the option is switched (hence the wait; it's probably not longer than if the user presses Enter at that point). This also causes the uses to need to click on the canvas to be able to transform it further.
Comment 2 Dmitry Kazakov 2022-08-12 10:12:54 UTC
Git commit 9e1ca4bea9e9cf91b33ce3b5be6eaad6e966bbdb by Dmitry Kazakov.
Committed on 12/08/2022 at 10:12.
Pushed by dkazakov into branch 'master'.

Fix a potential deadlock when transform tool requests config update

Config update via the notifier starts a lot of processes, like display
filter config change. That can potentially have a race condition with
a running transform tool. This patch just makes the tool to propagate
this update internally.

M  +18   -0    plugins/tools/tool_transform2/kis_tool_transform.cc
M  +1    -0    plugins/tools/tool_transform2/kis_tool_transform.h
M  +8    -1    plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
M  +2    -0    plugins/tools/tool_transform2/kis_tool_transform_config_widget.h

https://invent.kde.org/graphics/krita/commit/9e1ca4bea9e9cf91b33ce3b5be6eaad6e966bbdb
Comment 3 Dmitry Kazakov 2022-08-12 10:12:58 UTC
Git commit 329893b42ae28aa7075caaa5bbd6a4a7affe356b by Dmitry Kazakov.
Committed on 12/08/2022 at 10:12.
Pushed by dkazakov into branch 'krita/5.1'.

Fix a potential deadlock when transform tool requests config update

Config update via the notifier starts a lot of processes, like display
filter config change. That can potentially have a race condition with
a running transform tool. This patch just makes the tool to propagate
this update internally.

M  +18   -0    plugins/tools/tool_transform2/kis_tool_transform.cc
M  +1    -0    plugins/tools/tool_transform2/kis_tool_transform.h
M  +8    -1    plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
M  +2    -0    plugins/tools/tool_transform2/kis_tool_transform_config_widget.h

https://invent.kde.org/graphics/krita/commit/329893b42ae28aa7075caaa5bbd6a4a7affe356b