Bug 502157 - Krita Next Nightlies SAFE ASSERT Internal Errors and Crash when using Tablet
Summary: Krita Next Nightlies SAFE ASSERT Internal Errors and Crash when using Tablet
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tablets (tablet issues are only very rarely bugs in Krita!) (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Appimage Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression
: 502222 502471 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-03-29 14:12 UTC by Tyson Tan
Modified: 2025-04-06 12:57 UTC (History)
5 users (show)

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


Attachments
SAFE ASSERT Internal Errors and Crash when using Tablet (98.10 KB, image/png)
2025-03-29 14:12 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2025-03-29 14:12:53 UTC
Created attachment 179843 [details]
SAFE ASSERT Internal Errors and Crash when using Tablet

Since March 27, 2025, the Krita Next Nightlies give SAFE ASSERT Internal Errors and crash when the stylus is put on a graphics tablet.

Krita has encountered an internal error: 
SAFE ASSERT (krita): "!m_derivedResources.contains(converter->key())" in file /builds/graphics/krita/fibs/flake/ KoResourceManager_p.cpp, line 266 

Krita has encountered an internal error: SAFE ASSERT (krita): "!m_sanitylsStarting" in file /builds/graphics/ krita/libs/global/kis_signal_compressor.cpp, line 210

Tested under Linux with krita-5.3.0-prealpha-6f80cd8412-x86_64.AppImage (2025-03-29, and the one before it)
Comment 1 stuff 2025-03-30 09:08:53 UTC
It seems to happen the first time the stylus (not mouse) is moved over the canvas, but it depends on what tool is active.  If the brush tool is active for the first stylus motion(?) over the canvas, it triggers the assert.  But if instead another tool (e.g. the move tool) is active, then there is no failed assert, and then you can switch to the brush tool and it's fine.
Comment 2 stuff 2025-03-30 09:34:58 UTC
Opening a second image also triggers the line 266 assert, immediately
Comment 3 Freya Lupen 2025-03-30 22:03:48 UTC
Confirming the ResourceManager safe assert, this appears to be caused by "Remember tool opacity after brush switch" (https://invent.kde.org/graphics/krita/-/merge_requests/2218).

With both putting the stylus in proximity and opening a document after the first, KoResourceManager::addDerivedResourceConverter() (which contains the safe assert) is being called by KoToolManager::Private::switchTool(), KoToolManager.cpp:529. In the latter case "A derived resource converter with the same resource ID exists!" is logged before the safe assert.
Comment 4 Freya Lupen 2025-03-31 01:56:19 UTC
I can also confirm the signal compressor safe assert (two, actually) when the stylus comes in proximity with the canvas the first time with the nightly build (krita-6.0.0-prealpha-eb7151a), but not my local build of 5.3.x or 6.x for some unknown reason.

> SAFE ASSERT (krita): "!m_sanityIsStarting" in file /Users/gitlab/ws/builds/t1_Sat4Gr/0/graphics/krita/libs/global/kis_signal_compressor.cpp, line 210
> SAFE ASSERT (krita): "!m_derivedResources.contains(converter->key())" in file /Users/gitlab/ws/builds/t1_Sat4Gr/0/graphics/krita/libs/flake/KoResourceManager_p.cpp, line 266
> SAFE ASSERT (krita): "m_timer->isActive()" in file /Users/gitlab/ws/builds/t1_Sat4Gr/0/graphics/krita/libs/global/kis_signal_compressor.cpp, line 148
Comment 5 Freya Lupen 2025-03-31 02:02:22 UTC
*** Bug 502222 has been marked as a duplicate of this bug. ***
Comment 6 Scott Petrovic 2025-03-31 18:20:38 UTC
I am getting a very similar error with the SAFE_ASSERT for the m_derviedResources.contains() on the same line of KoResourceManager.cpp. I am running a script via Scripter on Windows 11

newDocument = Krita.instance().createDocument(1280, 1024, "Document name", "RGBA", "U8", "", 300.0)
Krita.instance().activeWindow().addView(newDocument) # shows it in the application # this line is throwing the safe assert
Comment 7 Freya Lupen 2025-04-06 03:05:50 UTC
Fixed by https://invent.kde.org/graphics/krita/-/commit/647fcbf1. I get no safe asserts on the 5.3.0-prealpha-647fcbf1 nightly build.
Comment 8 Tyson Tan 2025-04-06 03:52:33 UTC
Thank you, I've confirmed that too! :)
Comment 9 Freya Lupen 2025-04-06 12:57:14 UTC
*** Bug 502471 has been marked as a duplicate of this bug. ***