Bug 516204 - Krita crashes on Fedora 41 in KoFontRegistry
Summary: Krita crashes on Fedora 41 in KoFontRegistry
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (other bugs)
Version First Reported In: 5.3.0-beta1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2026-02-18 13:25 UTC by Cristi
Modified: 2026-03-11 09:28 UTC (History)
2 users (show)

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


Attachments
GDB Backtrace (14.04 KB, text/plain)
2026-02-18 13:25 UTC, Cristi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cristi 2026-02-18 13:25:03 UTC
Created attachment 189743 [details]
GDB Backtrace

SUMMARY
Krita 5.3.0, 6.0.0 beta 1, and 6.0.0 beta 2 crash on Fedora 41 with an out_of_range exception

STEPS TO REPRODUCE
1. Open the Krita AppImage from the terminal
2. Crash

OBSERVED RESULT
Krita crashes when opening the AppImage

EXPECTED RESULT
Krita should not crash

SOFTWARE/OS VERSIONS
OS: Fedora Linux 41 (wayland)
Compositor: hyprland


ADDITIONAL INFORMATION
Backtrace is in the attachment
Comment 1 Dmitry Kazakov 2026-02-18 13:30:31 UTC
The crash happens because of this line:

https://invent.kde.org/graphics/krita/-/blob/master/libs/flake/text/KoFontRegistry.cpp#L548

FT_New_Face returns failure, hence `lengths` and `faces` vectors start to have different sizes, which is wrong.

So, the bug has two parts:

1) Make sure that `lengths` and `faces` have the same size even when FT_New_Face returns failure (either be inserting a fallback face, or modifying both vectors)

2) Find out why FT_New_Face returns failure, is it our own fault?
Comment 2 Bug Janitor Service 2026-03-10 14:27:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2690
Comment 3 Dmitry Kazakov 2026-03-11 09:27:34 UTC
Git commit aa8c8c9d70b595fc77baffcec1979e81847e3cd7 by Dmitry Kazakov, on behalf of Wolthera van Hövell.
Committed on 11/03/2026 at 09:27.
Pushed by dkazakov into branch 'master'.

Ensure length and font list is similar and catch freetype errors

Sometimes the font doesn't load, and then there's a mismatch in font and length
sizes, causing a crash. We try to make sure these values are the same, log an
error when the font cannot be loaded, and try to use a previous or fallback font
when a font cannot be loaded.

M  +75   -17   libs/flake/text/KoFontRegistry.cpp

https://invent.kde.org/graphics/krita/-/commit/aa8c8c9d70b595fc77baffcec1979e81847e3cd7
Comment 4 Dmitry Kazakov 2026-03-11 09:28:00 UTC
Git commit 2047cbd6557a509649b941ae8dfdb8ddd683e575 by Dmitry Kazakov.
Committed on 11/03/2026 at 09:27.
Pushed by dkazakov into branch 'krita/6.0'.

Ensure length and font list is similar and catch freetype errors

Sometimes the font doesn't load, and then there's a mismatch in font and length
sizes, causing a crash. We try to make sure these values are the same, log an
error when the font cannot be loaded, and try to use a previous or fallback font
when a font cannot be loaded.


(cherry picked from commit aa8c8c9d70b595fc77baffcec1979e81847e3cd7)

9e40160c Ensure length and font list is similar, add ability to identify freetype error.
3bb2f4e6 Add assert in KoFontRegistry, ensure the fallback font has it's fontsize configured.

Co-authored-by: Wolthera van Hövell <griffinvalley@gmail.com>

M  +75   -17   libs/flake/text/KoFontRegistry.cpp

https://invent.kde.org/graphics/krita/-/commit/2047cbd6557a509649b941ae8dfdb8ddd683e575