Bug 460557 - Selection content deleted after transform but remains on screen until canvas area is "refreshed"
Summary: Selection content deleted after transform but remains on screen until canvas ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (show other bugs)
Version: 5.0.2
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-16 21:05 UTC by ecen.cronzeton
Modified: 2022-11-10 22:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Krita System Information for Kubuntu (15.66 KB, text/plain)
2022-10-16 21:05 UTC, ecen.cronzeton
Details
Krita Usage Log for the session recorded in video (2.30 KB, text/plain)
2022-10-16 21:06 UTC, ecen.cronzeton
Details
DebugView log of replicating the bug on git be1bfa4 (7.48 KB, text/plain)
2022-11-05 22:48 UTC, ecen.cronzeton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ecen.cronzeton 2022-10-16 21:05:47 UTC
Created attachment 152913 [details]
Krita System Information for Kubuntu

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Draw a line and a triangle.
2. Use the freehand selection tool (select with hotkey) to select the triangle. 
3. Select the transform tool (select with hotkey) and do multiple transforms to the selection (rotation, scaling and translation).
4. Press enter to apply the transformations. Note that the selection lines jumps here.
5. Select freehand selection tool (select with hotkey) and click on the canvas to remove selection.
6. Draw on top of the transformed triangle. Note that the triangle lines are disappearing around newly drawn lines.
7. "Refresh" the canvas by hiding and unhiding the layer to reveal that the entire selection has actually disappeared.

OBSERVED RESULT
The content in the selected area has disappeared. In step 6, drawing new lines on top of the triangle causes white squares around the new lines to be removed from the old triangle lines.

EXPECTED RESULT
The selected area is transformed.

SOFTWARE/OS VERSIONS
Windows: Windows 10
Linux/KDE Plasma: Kubuntu, Manjaro KDE Edition

ADDITIONAL INFORMATION
Video here: https://www.youtube.com/watch?v=rBUyZqPR1pE

The video is from Kubuntu Linux using Krita 5.0.2 (the latest snap). But I have the same issue on Windows with Krita 5.0.0 and 5.1.0, and on Manjaro Linux using Krita 5.0.2 and 5.1.0. I have had this issue since the I tried the Krita 5.0 beta on my then new 4k screen.

In step 4, only translation does not trigger the bug, but any other set of transforms often does. Multiple transforms seems to almost always trigger it.

Undoing (ctrl+z) to undo the transformation makes the deleted content re-appear.

Workaround: Between step 4 and 5, draw a line inside the selection, the undo the line. Now the bug will usually not happen (transforms succeeds maybe 80% of the time), but still happens occasionally. When that happens, undo the transform, do it again and retry the workaround.
Comment 1 ecen.cronzeton 2022-10-16 21:06:27 UTC
Created attachment 152914 [details]
Krita Usage Log for the session recorded in video
Comment 2 Dmitry Kazakov 2022-11-04 15:36:07 UTC
Hi, Ecen!

Could you please test this package if the problem is reproducible with it?

https://disk.yandex.ru/d/zPC8Mv85r2tJyQ

Please also run DebugView alongside Krita to make sure the catch extra debugging this package dumps.
Comment 3 ecen.cronzeton 2022-11-04 18:28:20 UTC
Hi Dmitry,

Before using the package I wanted to verify that I was still getting the bug, and I found out what is causing it:

I have always had my Freehand Selection Tool bound to V. But the bug only happens if I use that hotkey in step 5. Without a hotkey, OR by rebinding the tool to N, the bug does not happen. I also noticed that even when V is bound to the tool, while V is being held down, some function of the Line Tool is selected and my bound hotkey only applies when V is released. It seems to be this rapid switching to the Line Tool that causes this issue by somehow deleting the selected content without updating the canvas.

Knowing this, I can just use a different hotkey, and thus this is no longer an issue for me. It is still a bug, but I'm happy to let you close or downgrade this as you wish.

I'm unsure of how to use the package you linked (install as a krita resource?), but hopefully this should no longer be needed, though please tell me if it is.
Comment 4 Dmitry Kazakov 2022-11-05 21:17:32 UTC
Hi, Ecen!

The bug is still valid. I linked a prebuilt Windows package (you said you tested on it :) ). You need to just unpack the zip archive and run Krita from it.

About the shortcuts: yes, 'V' is the shortcut that temporarily enables line tool. You can disable that in Preferences->Canvas Input Actions->Tool Invocation.

I do wonder if this bug is actually related to the line tool bug I fixed a bit earlier. Perhaps you could also test these stable packages? (with the old configuration of your shortcuts)

Windows: https://binary-factory.kde.org/job/Krita_Stable_Windows_Build/
Linux: https://binary-factory.kde.org/job/Krita_Stable_Appimage_Build/

I guess you should first test with one of these packages, and if you can still reproduce the bug, then test the package I linked above (on Windows):

https://disk.yandex.ru/d/zPC8Mv85r2tJyQ
Comment 5 ecen.cronzeton 2022-11-05 22:46:54 UTC
The bug is reproducible on the stable package (tested the Linux one) and on the first one you linked. 

I'm attaching the debug view log of starting the first package you linked and replicating the bug. (There was some issue creating a new file, but I just pressed ignore a few times and it went away.)
Comment 6 ecen.cronzeton 2022-11-05 22:48:12 UTC
Created attachment 153505 [details]
DebugView log of replicating the bug on git be1bfa4
Comment 7 Dmitry Kazakov 2022-11-07 11:04:50 UTC
Hi, Ecen!

Thank you for your info! Thanks to that I've managed to reproduce the problem and I have a potential fix. Could you please test a Windows package below? It should have the bug fixed.

https://disk.yandex.ru/d/2Je40u-Z5ySkrQ
Comment 8 Dmitry Kazakov 2022-11-09 11:33:15 UTC
Git commit 01b342fc07c1a8bcaa210c81b194e2a34020b299 by Dmitry Kazakov.
Committed on 09/11/2022 at 11:32.
Pushed by dkazakov into branch 'master'.

Fix image data loss in when the transform tool action is applied to quickly

It may happen when the tool is quickly switched to and from
by V shortcut assigned to the Brush Tool.
Related: bug 461109

M  +11   -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp

https://invent.kde.org/graphics/krita/commit/01b342fc07c1a8bcaa210c81b194e2a34020b299
Comment 9 Dmitry Kazakov 2022-11-09 11:38:48 UTC
Git commit 825fa9d2b04847cfa5dffcc8600ff02c665d4f1b by Dmitry Kazakov.
Committed on 09/11/2022 at 11:38.
Pushed by dkazakov into branch 'krita/5.1'.

Fix image data loss in when the transform tool action is applied to quickly

It may happen when the tool is quickly switched to and from
by V shortcut assigned to the Brush Tool.
Related: bug 461109

M  +11   -0    plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp

https://invent.kde.org/graphics/krita/commit/825fa9d2b04847cfa5dffcc8600ff02c665d4f1b
Comment 10 ecen.cronzeton 2022-11-10 22:22:06 UTC
I can confirm that the bug does not happen in the package you sent.

Thank you very much and for your hard work on Krita! It's such an awesome application :)