Bug 508083

Summary: Krita crashes when adding Text
Product: [Applications] krita Reporter: HittyGubby <3488704699>
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: crash CC: griffinvalley
Priority: NOR    
Version First Reported In: 5.2.11   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: font causing crash

Description HittyGubby 2025-08-10 14:37:37 UTC
As in title. To replicate, just add text on an image and it crashes
Here are some gdb logs but idk if it's going to help since i got no debug symbols
---
(gdb) run
Starting program: /usr/bin/krita 
Function(s) ^std::(move|forward|as_const|(__)?addressof) will be skipped when stepping.
Function(s) ^std::(shared|unique)_ptr<.*>::(get|operator) will be skipped when stepping.
Function(s) ^std::(basic_string|vector|array|deque|(forward_)?list|(unordered_|flat_)?(multi)?(map|set)|span)<.*>::(c?r?(begin|end)|front|back|data|size|empty) will be skipped when stepping.
Function(s) ^std::(basic_string|vector|array|deque|span)<.*>::operator.] will be skipped when stepping.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffef1d86c0 (LWP 2370018)]
[New Thread 0x7fffed55a6c0 (LWP 2370019)]
[New Thread 0x7fffecd596c0 (LWP 2370020)]
[New Thread 0x7fffe7fff6c0 (LWP 2370021)]
[New Thread 0x7fffe77fe6c0 (LWP 2370022)]
[New Thread 0x7fffdbfff6c0 (LWP 2370023)]
[New Thread 0x7fffdb7fe6c0 (LWP 2370024)]
[New Thread 0x7fffdaffd6c0 (LWP 2370025)]
[New Thread 0x7fffda7fc6c0 (LWP 2370026)]
[Thread 0x7fffda7fc6c0 (LWP 2370026) exited]
[Thread 0x7fffdaffd6c0 (LWP 2370025) exited]
[Thread 0x7fffef1d86c0 (LWP 2370018) exited]
[Thread 0x7fffdb7fe6c0 (LWP 2370024) exited]
[Thread 0x7fffdbfff6c0 (LWP 2370023) exited]
[New Thread 0x7fffdbfff6c0 (LWP 2370027)]
[New Thread 0x7fffdb7fe6c0 (LWP 2370028)]
[New Thread 0x7fffef1d86c0 (LWP 2370029)]
[New Thread 0x7fffdaffd6c0 (LWP 2370030)]
[New Thread 0x7fffda7fc6c0 (LWP 2370031)]
[Thread 0x7fffda7fc6c0 (LWP 2370031) exited]
[Thread 0x7fffdaffd6c0 (LWP 2370030) exited]
[Thread 0x7fffdbfff6c0 (LWP 2370027) exited]
[Thread 0x7fffef1d86c0 (LWP 2370029) exited]
[Thread 0x7fffdb7fe6c0 (LWP 2370028) exited]
[New Thread 0x7fffdb7fe6c0 (LWP 2370032)]
[New Thread 0x7fffef1d86c0 (LWP 2370033)]
[New Thread 0x7fffdbfff6c0 (LWP 2370034)]
[New Thread 0x7fffdaffd6c0 (LWP 2370035)]
[New Thread 0x7fffda7fc6c0 (LWP 2370036)]
[Thread 0x7fffda7fc6c0 (LWP 2370036) exited]
[Thread 0x7fffdaffd6c0 (LWP 2370035) exited]
[Thread 0x7fffdb7fe6c0 (LWP 2370032) exited]
[Thread 0x7fffdbfff6c0 (LWP 2370034) exited]
[Thread 0x7fffef1d86c0 (LWP 2370033) exited]
[New Thread 0x7fffef1d86c0 (LWP 2370037)]
[New Thread 0x7fffdbfff6c0 (LWP 2370038)]
[New Thread 0x7fffdb7fe6c0 (LWP 2370039)]
[New Thread 0x7fffdaffd6c0 (LWP 2370040)]
[New Thread 0x7fffda7fc6c0 (LWP 2370041)]
[New Thread 0x7fffd9ffb6c0 (LWP 2370042)]
[New Thread 0x7fffd97fa6c0 (LWP 2370043)]
[Thread 0x7fffd97fa6c0 (LWP 2370043) exited]
[Thread 0x7fffd9ffb6c0 (LWP 2370042) exited]
[New Thread 0x7fffd9ffb6c0 (LWP 2370044)]
[New Thread 0x7fffd97fa6c0 (LWP 2370045)]
[New Thread 0x7fffd8e686c0 (LWP 2370046)]
[New Thread 0x7fffb3fff6c0 (LWP 2370047)]
Invalid profile :  "/usr/share/color/icc/colord/Crayons.icc"
Invalid profile :  "/usr/share/color/icc/colord/x11-colors.icc"
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
[New Thread 0x7fffb33ff6c0 (LWP 2370048)]
QObject::startTimer: Timers cannot have negative intervals
[New Thread 0x7fffb2bfe6c0 (LWP 2370049)]
[New Thread 0x7fffb23fd6c0 (LWP 2370050)]
[Thread 0x7fffb2bfe6c0 (LWP 2370049) exited]
/usr/lib/krita-python-libs/krita added to PYTHONPATH
/usr/share/krita/pykrita/comics_project_management_tools/comics_exporter.py:432: SyntaxWarning: invalid escape sequence '\d'
  svgRegExp = re.compile('[MLCSQHVATmlzcqshva]\d+\.?\d* \d+\.?\d*')
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_ACBF_XML_Exporter.py:510: SyntaxWarning: invalid escape sequence '\<'
  string = re.sub("\<\/*?text.*?\>",'', str(v["text"]))
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_ACBF_XML_Exporter.py:511: SyntaxWarning: invalid escape sequence '\s'
  string = re.sub("\s+?", " ", string)
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_po_parser.py:49: SyntaxWarning: invalid escape sequence '\<'
  text = re.sub("\<.*?\>", " ", text)
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_po_parser.py:50: SyntaxWarning: invalid escape sequence '\s'
  key += str(re.sub("\s+", " ", text)).strip()
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_po_parser.py:114: SyntaxWarning: invalid escape sequence '\<'
  key = re.sub("\<.*?\>", " ", key)
/usr/share/krita/pykrita/comics_project_management_tools/exporters/CPMT_po_parser.py:115: SyntaxWarning: invalid escape sequence '\s'
  key = re.sub("\s+", " ", key)
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:33: SyntaxWarning: invalid escape sequence '\+'
  '\+', '-', '\*', '/', '//', '\%', '\*\*',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:33: SyntaxWarning: invalid escape sequence '\*'
  '\+', '-', '\*', '/', '//', '\%', '\*\*',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:33: SyntaxWarning: invalid escape sequence '\%'
  '\+', '-', '\*', '/', '//', '\%', '\*\*',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:33: SyntaxWarning: invalid escape sequence '\*'
  '\+', '-', '\*', '/', '//', '\%', '\*\*',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:35: SyntaxWarning: invalid escape sequence '\+'
  '\+=', '-=', '\*=', '/=', '\%=',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:35: SyntaxWarning: invalid escape sequence '\*'
  '\+=', '-=', '\*=', '/=', '\%=',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:35: SyntaxWarning: invalid escape sequence '\%'
  '\+=', '-=', '\*=', '/=', '\%=',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:37: SyntaxWarning: invalid escape sequence '\^'
  '\^', '\|', '\&', '\~', '>>', '<<',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:37: SyntaxWarning: invalid escape sequence '\|'
  '\^', '\|', '\&', '\~', '>>', '<<',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:37: SyntaxWarning: invalid escape sequence '\&'
  '\^', '\|', '\&', '\~', '>>', '<<',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:37: SyntaxWarning: invalid escape sequence '\~'
  '\^', '\|', '\&', '\~', '>>', '<<',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\{'
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\}'
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\('
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\)'
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\['
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/syntax/syntax.py:42: SyntaxWarning: invalid escape sequence '\]'
  '\{', '\}', '\(', '\)', '\[', '\]',
/usr/share/krita/pykrita/scripter/ui_scripter/editor/pythoneditor.py:285: SyntaxWarning: invalid escape sequence '\)'
  * with a backslash (\) then this is a continuation line, probably
Warning: requested data for unknown action "path-break-at-selection"
[New Thread 0x7fffb2bfe6c0 (LWP 2370052)]
[New Thread 0x7fff9e8186c0 (LWP 2370078)]
[New Thread 0x7fff9d8166c0 (LWP 2370098)]
[New Thread 0x7fff9d0156c0 (LWP 2370099)]
[New Thread 0x7fff9c8146c0 (LWP 2370100)]
[New Thread 0x7fff8bfff6c0 (LWP 2370101)]
[New Thread 0x7fff8b7fe6c0 (LWP 2370102)]
[New Thread 0x7fff8affd6c0 (LWP 2370103)]
[New Thread 0x7fff7683e6c0 (LWP 2370104)]
[New Thread 0x7fff7603d6c0 (LWP 2370105)]
[New Thread 0x7fff74f056c0 (LWP 2370106)]
[New Thread 0x7fff63fff6c0 (LWP 2370107)]

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
0x00007ffff60170d8 in ?? () from /usr/lib/libQt5Gui.so.5
(gdb) bt
#0  0x00007ffff60170d8 in ??? () at /usr/lib/libQt5Gui.so.5
#1  0x00007ffff60213f0 in QFontDatabase::font(QString const&, QString const&, int) const () at /usr/lib/libQt5Gui.so.5
#2  0x00007ffff493b48a in KisFontComboBoxes::currentFont(int) const ()
    at /usr/lib/libkritawidgetutils.so.19
#3  0x00007fffc9221176 in ??? ()
    at /usr/lib/kritaplugins/krita_tool_svgtext.so
#4  0x00007fffc9222847 in ??? ()
    at /usr/lib/kritaplugins/krita_tool_svgtext.so
#5  0x00007ffff4f00357 in KoToolProxy::mouseReleaseEvent(KoPointerEvent*) ()
    at /usr/lib/libkritaflake.so.19
#6  0x00007ffff4f00b08 in KoToolProxy::mouseReleaseEvent(QMouseEvent*, QPointF const&) () at /usr/lib/libkritaflake.so.19
#7  0x00007ffff777aecf in KisToolProxy::forwardEvent(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QEvent*) () at /usr/lib/libkritaui.so.19
#8  0x00007ffff7a8751a in ??? () at /usr/lib/libkritaui.so.19
#9  0x00007ffff7a906b1 in KisShortcutMatcher::tryEndRunningShortcut(Qt::MouseButton, QEvent*) () at /usr/lib/libkritaui.so.19
#10 0x00007ffff7a90789 in KisShortcutMatcher::buttonReleased(Qt::MouseButton, QEvent*) () at /usr/lib/libkritaui.so.19
#11 0x00007ffff7a7e5c8 in KisInputManager::eventFilterImpl(QEvent*) ()
    at /usr/lib/libkritaui.so.19
#12 0x00007ffff5acf8ce in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff6758636 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff675dd51 in QApplication::notify(QObject*, QEvent*) ()
    at /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff7b02bcf in KisApplication::notify(QObject*, QEvent*) ()
    at /usr/lib/libkritaui.so.19
#16 0x00007ffff5acfb68 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#17 0x00007ffff675bb76 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) ()
    at /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff67b35e1 in ??? () at /usr/lib/libQt5Widgets.so.5
#19 0x00007ffff67b566f in ??? () at /usr/lib/libQt5Widgets.so.5
#20 0x00007ffff6758646 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007ffff7b02bcf in KisApplication::notify(QObject*, QEvent*) ()
    at /usr/lib/libkritaui.so.19
--Type <RET> for more, q to quit, c to continue without paging--
) () at /usr/lib/libQt5Core.so.5
#23 0x00007ffff5f3ff38 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt5Gui.so.5
#24 0x00007ffff5f1f56d in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5
#25 0x00007fffef8cf038 in ??? () at /usr/lib/libQt5XcbQpa.so.5
#26 0x00007ffff310887d in ??? () at /usr/lib/libglib-2.0.so.0
#27 0x00007ffff3109cd7 in ??? () at /usr/lib/libglib-2.0.so.0
#28 0x00007ffff3109ee5 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#29 0x00007ffff5b21489 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#30 0x00007ffff5ac807b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#31 0x00007ffff5ad439b in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#32 0x000055555555c03a in ??? ()
#33 0x00007ffff52376b5 in ??? () at /usr/lib/libc.so.6
#34 0x00007ffff5237769 in __libc_start_main () at /usr/lib/libc.so.6
#35 0x000055555555e055 in ??? ()
---
Comment 1 wolthera 2025-08-10 15:24:58 UTC
Hi, thanks for the report,

Looks like it is crashing inside Qt itself, specifically the font database. Could you share which font you have selected in the text tool options' font dropdown, when you're making a text?

(In Krita 5.3 we're replacing that bit of code, but it'd be good to know what update QFontDatabase so I can make sure the new code doesn't have it)
Comment 2 HittyGubby 2025-08-10 17:38:32 UTC
Created attachment 183937 [details]
font causing crash
Comment 3 HittyGubby 2025-08-10 17:39:08 UTC
Just noticed it's the font's problem. Krita works well when using other fonts, but this Aldrich font always crashes. Maybe it is the first in alphabetical order by default. The font file is above.
Comment 4 wolthera 2025-08-10 18:50:11 UTC
Weird thing is that I cannot reproduce it with 5.2.11, nor in the nightlies. My best guess is that it is because the appimage uses a patched Qt version, and the crash is happening inside qt and we may have patched that somehow. And because I don't run Manjaro I won't be able to fix this. :(

My advice to you is to either a) use the appimage for 5.2.11, b) not use this font, c) wait for it to be fixed with 5.3 (as I'm rewriting the text tool, and we are by and large avoiding interaction with QFontDatabase, where the crash is happening).

If you have any questions, feel free to ask them.
Comment 5 HittyGubby 2025-08-10 19:58:21 UTC
(In reply to wolthera from comment #4)
> Weird thing is that I cannot reproduce it with 5.2.11, nor in the nightlies.
> My best guess is that it is because the appimage uses a patched Qt version,
> and the crash is happening inside qt and we may have patched that somehow.
> And because I don't run Manjaro I won't be able to fix this. :(
> 
> My advice to you is to either a) use the appimage for 5.2.11, b) not use
> this font, c) wait for it to be fixed with 5.3 (as I'm rewriting the text
> tool, and we are by and large avoiding interaction with QFontDatabase, where
> the crash is happening).
> 
> If you have any questions, feel free to ask them.

I was using Qt 6.9.1-1, what version were you using?
I have replaced the font with another version and it works now, thanks!
Comment 6 wolthera 2025-08-10 20:27:32 UTC
(In reply to HittyGubby from comment #5)
> I was using Qt 6.9.1-1, what version were you using?
> I have replaced the font with another version and it works now, thanks!

Krita is fomally still on Qt5 (Qt 5.15.7 in the appimages, and we patch it too), so chances are your distro is still using 5.15~ for Krita. We are working on qt6 support for Krita 6

Good to know it now works!