Bug 475448 - data loss when copy pasting into active layer in subwindow mode.
Summary: data loss when copy pasting into active layer in subwindow mode.
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Transform (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-10 23:05 UTC by vanyossi
Modified: 2024-09-12 05:19 UTC (History)
1 user (show)

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


Attachments
undo crash (38.44 KB, text/plain)
2023-10-10 23:13 UTC, vanyossi
Details
backtrace closing (24.19 KB, text/plain)
2023-10-10 23:13 UTC, vanyossi
Details
subwindow arragement for test (821.56 KB, video/mp4)
2023-10-10 23:33 UTC, vanyossi
Details
Faulty state (197.55 KB, image/png)
2024-09-12 05:19 UTC, vanyossi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vanyossi 2023-10-10 23:05:09 UTC
The bug causes data loss only in subwindow mode with both subwindows visible. Tabbed mode or subwindows both in full screen and using the menu to switch documents does not trigger apparently any issue. Tested on 5.1.5, and master (21c93450d8)

To reproduce:
make 2 images A and B (A is source with paint info, B will be empty here)
Select from image A 
Edit-> Paste into active layer: to B (!this is important as paste into active layer activates transform)
Ctrl + Z <- undo should make the transform go away, but it doesn't until the second a undo is perform
Ctrl + Z <- transforms dissapears
Go back image A, Copy
Activate image B

Depending on windows some minor differences happen
Tabs: A legend "cannot transform empty region" (this assumes initial condition of empty image B)
Subwindows: A ghost transform decoration (in the video) appears, the image A tile data is deleted, this is permanent if transform is done in any way to this ghost outline, if enter is pressed the data reapppers in image A. If the transform mask is modified in this state then returning to image A and deleting the selection and then selecting image B subwindow destroys the entire paint data of image A.

Terminal output
2023-10-10 15:33:56.755317-0600 krita[95800:4455524] [krita.general] Unexpected tool event has come to cancelStroke while being mode 0 !
2023-10-10 15:18:07.888869-0600 krita[95588:4445691] SAFE ASSERT (krita): "dst->lodData->levelOfDetail() == defaultBounds->currentLevelOfDetail()" in file /Users/daedalus/developer/krita/repos/master/krita/libs/image/kis_paint_device.cc, line 845
2023-10-10 15:18:10.646901-0600 krita[95588:4446046] SAFE ASSERT (krita): "changeList.memento == memento" in file /Users/daedalus/developer/krita/repos/master/krita/libs/image/tiles3/kis_memento_manager.cc, line 275
2023-10-10 15:18:46.549543-0600 krita[95588:4444795] [krita] CGImageDestinationAddImage:4060: *** ERROR: CGImageDestinationAddImage: cgImage is nil
2023-10-10 15:18:46.550962-0600 krita[95588:4444795] [krita] finalizeDestination:3167: *** ERROR: image destination must have at least one image
2023-10-10 15:18:46.552450-0600 krita[95588:4444795] [krita.general] Warning: some tiles have leaked:
2023-10-10 15:18:46.552463-0600 krita[95588:4444795] [krita.general]    Tiles in memory: 249
Comment 1 vanyossi 2023-10-10 23:13:10 UTC
Created attachment 162204 [details]
undo crash

it sometimes causes krita to crash trying to undo many times into the original image A state
Comment 2 vanyossi 2023-10-10 23:13:59 UTC
Created attachment 162205 [details]
backtrace closing

when closing krita in the corrupt state it often shows this backtrace.
Comment 3 vanyossi 2023-10-10 23:33:08 UTC
Created attachment 162206 [details]
subwindow arragement for test

at the end Pasting is shown as "Add Node" in Undo history docker
Comment 4 Dmitry Kazakov 2024-09-11 07:59:22 UTC
I cannot fully reproduce the issue on Windows in master (1e0e095b69513d9a9d0a9b53c0512f50e3fc7977). Though I can reproduce a part of the issue. When I change the active subwindow, a part of "old" subwindow gets transparent for a moment and then returns back into the normal state. I have a feeling, that the transform tool gets momentary activated and deactivated **before** the subwindows actually manages to change.

Ivan, could you check if you can reproduce the issue in the following way:

1) Open two documents like in your setup
2) In Document A activate rectangle selection tool, select something
2) In Document B activate Transform Tool
3) Try switching between the documents back and forth. 

Do you still see the issue? At least partially?
Comment 5 vanyossi 2024-09-12 05:19:37 UTC
Created attachment 173575 [details]
Faulty state

Following your instructions I get a partial result, there is no dataloss but the rendering could indicate a lost signal. (attached image of the faulty state).

After making a selection on A and activating transform on B: alternating focus of window A and B causes the state in the attachment.  Window B is in focus for Window A to show the partial render. This by itself does not cause any data loss, and any action performed either in B or A will restore the full render on window A.