Bug 450577

Summary: Contiguous Selection Tool Hangs when double clicking on large canvas
Product: [Applications] krita Reporter: Andrea Montagna <fullmontis>
Component: Tools/SelectionAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: acc4commissions, dimula73, halla, tomtomtomreportingin
Priority: NOR Keywords: regression, triaged
Version: 5.0.2   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andrea Montagna 2022-02-19 16:17:24 UTC
SUMMARY

The Contiguous Selection Tool hangs Krita when double clicking on the canvas. By double clicking I mean clicking before the previous Contiguous Selection operation has concluded. If I only click once, the selection is completed correctly without issues. 

This only seems to be reproducible for me on large enough canvases in which the selection operation is not instantaneous, so this may depend on the system specs. It was reproducible for me down to a 1000x1000 canvas if I double click fast enough, but I also have a rather low end CPU (Ryzen 1300)

STEPS TO REPRODUCE
1. Open large enough empty canvas (2000x2000 or more)
2. Select Contiguous Selection Tool and Double click on canvas 

OBSERVED RESULT

Krita hangs and one core of the CPU is fully maxed until Krita is killed. Any other operation hangs, and trying to save the file opens the Continue/Stop operation and save/Close dialogue, but clicking on any button has no effect. The only way to resume work on krita is killing the window and opening a new session.

EXPECTED RESULT

The canvas is completely selected and the program resumes normal function

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Xubuntu 20.04.3 LTS
Qt Version: qt5-default 5.12.8+dfsg-0ubuntu2.1
Comment 1 Halla Rempt 2022-03-03 13:47:03 UTC
I've tried really hard, but either my pc is just too fast, or there's something else to it...
Comment 2 Andrea Montagna 2022-04-10 11:28:08 UTC
I have made a video where I show the bug in action. I am using a rather recent Krita Plus version, krita-5.0.2-alpha-6edabfa864-x86_64.appimage, downloaded from the website.

https://www.youtube.com/watch?v=9GgqJ3q_c6Y
Comment 3 Andrea Montagna 2022-04-10 12:15:35 UTC
I forgot to also add the console output when the program gets stuck:

SAFE ASSERT (krita): "(0)" in file /home/appimage/workspace/Krita_Stable_Appimage_Build/krita/libs/image/floodfill/kis_fill_interval_map.cpp, line 87
Comment 4 acc4commissions 2022-04-11 01:51:58 UTC
I have this problem too. The cpu doesn't maxed in my case, but the krita is stuck in 'Waiting for image operation to complete' and I can't do anything(even including closing krita) until krita is killed. I can't cancel the operation either.
Comment 5 tomtomtomreportingin 2022-07-12 11:42:53 UTC
I can confirm this in 5.1.0 git 28311ea. It ONLY occurs when the "Reference" option is set to merged copy of all layers.
Comment 6 tomtomtomreportingin 2022-07-12 11:56:30 UTC
I can't reproduce this in 4.4.8 but I can reproduce it in 5.0.0 (with the "All Layers" setting) so it seems to be a regression of Krita 5.
Comment 7 Dmitry Kazakov 2022-07-19 13:18:39 UTC
Upgrading the bug to "crash", because Krita becomes unusable after the bug manifests itself.
Comment 8 Dmitry Kazakov 2022-07-19 13:48:36 UTC
Git commit 7549b4ec3156a0174a4912509257d3dac094600b by Dmitry Kazakov.
Committed on 19/07/2022 at 13:48.
Pushed by dkazakov into branch 'krita/5.1'.

Fix a hangup when double-clicking with Flood Selection Tool

Since fill command may read from the merged image, it should wait
until the entire image completes its updates, therefore the job
type shoudl be 'barrier'.

M  +1    -1    plugins/tools/selectiontools/kis_tool_select_contiguous.cc

https://invent.kde.org/graphics/krita/commit/7549b4ec3156a0174a4912509257d3dac094600b
Comment 9 Dmitry Kazakov 2022-07-19 13:48:37 UTC
Git commit 295a63340397962446282a684c1f94b7385d17d2 by Dmitry Kazakov.
Committed on 19/07/2022 at 13:48.
Pushed by dkazakov into branch 'master'.

Fix a hangup when double-clicking with Flood Selection Tool

Since fill command may read from the merged image, it should wait
until the entire image completes its updates, therefore the job
type shoudl be 'barrier'.

M  +1    -1    plugins/tools/selectiontools/kis_tool_select_contiguous.cc

https://invent.kde.org/graphics/krita/commit/295a63340397962446282a684c1f94b7385d17d2