Bug 492114

Summary: [SAFE ASSERT] Switching to selected Snapshot cause a safe assert warning
Product: [Applications] krita Reporter: Protoniv <ss93078>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: penguinflyer2222
Priority: NOR Keywords: regression
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Protoniv 2024-08-24 02:13:36 UTC
SUMMARY
Use snapshot docker to "Switch to a selected Snapshot", a safe assert warning will popup, ignore it **won't**
 crash krita, but the bottom layer in Layer Docker will become Active Layer


Here is the terminal log with the bug trigger two times, first time "ignore" and the second time "Abort"
```
SAFE ASSERT (krita): "shape" in file /builds/graphics/krita/libs/ui/kis_node_manager.cpp, line 165
WARNING: idle task consumed more than 200 ms, it can cause visible distractions to the user
WARNING: time consumed in "layer-thumbnails-stroke" is 289 ms
SAFE ASSERT (krita): "shape" in file /builds/graphics/krita/libs/ui/kis_node_manager.cpp, line 165

Thread 1 "krita" received signal SIGABRT, Aborted.
0x00007ffff4aa94ac in __pthread_kill_implementation () from /lib64/libc.so.6
```

OpenSUSE 15.5/15.6 Leap
krita-5.3.0-prealpha-242de665a4-x86_64.appimage

STEPS TO REPRODUCE
1. Draw on canvas, and create a new snapshot with snapshot docker
2. continue drawing, and then select a snapshot and press "Switch to a selected Snapshot"
3. SAFE ASSERT popup

ADDITIONAL INFORMATION
Comment 1 Freya Lupen 2024-08-24 13:47:26 UTC
Confirmed on 5.3.0-prealpha git 0c8b46a8df as well as 5.2.3. It doesn't happen in 5.2.2.
Comment 2 Halla Rempt 2024-09-03 12:18:46 UTC
Git commit d1e839269fe08772c0483292dee5f25c69d83193 by Halla Rempt.
Committed on 03/09/2024 at 12:17.
Pushed by rempt into branch 'master'.

Remove superfluous commented-out return statements

Apparently I added those together with the safe asserts.

M  +0    -2    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/d1e839269fe08772c0483292dee5f25c69d83193
Comment 3 Halla Rempt 2024-09-03 12:19:13 UTC
Git commit 36e47aa0a2f0676705e809b865146ffacc96b2d3 by Halla Rempt.
Committed on 03/09/2024 at 12:19.
Pushed by rempt into branch 'krita/5.2'.

Remove superfluous commented-out return statements

Apparently I added those together with the safe asserts.
(cherry picked from commit d1e839269fe08772c0483292dee5f25c69d83193)

M  +0    -2    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/36e47aa0a2f0676705e809b865146ffacc96b2d3
Comment 4 Dmitry Kazakov 2024-09-13 13:49:53 UTC
Git commit 60c5dcaf3769268f763cc1be8bfe8c2076491906 by Dmitry Kazakov.
Committed on 13/09/2024 at 13:49.
Pushed by dkazakov into branch 'master'.

Fix an assert when trying to activate an image snapshot

Node activation should happen via KisImageSignalRouter since it
pushes the signal into the same queue where node removel/addition
signals go (via KisSynchronizedConnection).

M  +7    -1    plugins/dockers/snapshotdocker/KisSnapshotModel.cpp

https://invent.kde.org/graphics/krita/-/commit/60c5dcaf3769268f763cc1be8bfe8c2076491906
Comment 5 Dmitry Kazakov 2024-09-13 13:51:03 UTC
Git commit 91d3906f79676771842a34cb4bcf2d635f6ca896 by Dmitry Kazakov.
Committed on 13/09/2024 at 13:50.
Pushed by dkazakov into branch 'krita/5.2'.

Fix an assert when trying to activate an image snapshot

Node activation should happen via KisImageSignalRouter since it
pushes the signal into the same queue where node removel/addition
signals go (via KisSynchronizedConnection).

M  +7    -1    plugins/dockers/snapshotdocker/KisSnapshotModel.cpp

https://invent.kde.org/graphics/krita/-/commit/91d3906f79676771842a34cb4bcf2d635f6ca896