Bug 477413

Summary: Ghostwriter core dump if qt5-qtpbfimageformat is installed
Product: [Applications] ghostwriter Reporter: Tom <tk20>
Component: generalAssignee: megan.conkle
Status: REOPENED ---    
Severity: grave CC: demm, gwasser, tumic, tumic
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: gdb /usr/bin/ghostwriter 2>&1 | tee ~/ghostwriter.log

Description Tom 2023-11-23 11:32:50 UTC
Created attachment 163391 [details]
gdb /usr/bin/ghostwriter 2>&1 | tee ~/ghostwriter.log

SUMMARY
Ghostwriter won't start / immediately crashes if qt5-qtpbfimageformat is installed since it needs to construct a QGuiApplication before accessing QFontDatabase

For discussion of the cause see:
https://github.com/tumic0/QtPBFImagePlugin/issues/7

Reference to the bug report in Fedora which blames ghostwriter:
https://bugzilla.redhat.com/show_bug.cgi?id=2225531

Version-Release number of selected component (if applicable):
ghostwriter 23.08.01
qt5-qtpbfimageformat-2.3-9

How reproducible:
Reliably

STEPS TO REPRODUCE
1. Install qt5-qtpbfimageformat-2.3-9
2. Install ghostwriter 23.08.01
3. Start ghostwriter
(using Fedora 38 - fc38.x86_64  )

OBSERVED RESULT
Terminal output:
"""
QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase
Aborted (core dumped)
"""

EXPECTED RESULT
Ghostwriter starts as intended.

Additional info:
Uninstalling qt5-qtpbfimageformat fixes the issue
This issue has been discussed before upstream: https://github.com/tumic0/QtPBFImagePlugin/issues/7
Attached is the output of gdb /usr/bin/ghostwriter 2>&1 | tee ~/ghostwriter.log



1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Martin Tůma 2023-12-09 21:58:03 UTC
In markdowneditor.cpp:179 ghostwriter calls the QImage API (through the static function buildImageReaderFormats() ) before QGuiApplication is created.
Comment 2 megan.conkle 2024-07-07 01:22:44 UTC
Recent port to Qt6 should resolve this issue.
Comment 3 Martin Tůma 2024-07-19 07:19:07 UTC
(In reply to megan.conkle from comment #2)
> Recent port to Qt6 should resolve this issue.

A bare port to Qt6 will definitely not fix anything, you have to fix the broken initialization code in Ghostwriter. You can not rely on the trigger of the Ghostwriter bug going away by switching to Qt6 with qt5-qtpbfimageformat not being used anymore as there is also a Qt6 version of the plugin. Moreover, __any Qt image plugin may crash Ghostwriter__ at any time when it decides to use functions from the QtGUI API which is perfectly legal for a Qt image plugin.
Comment 4 Garret Wassermann 2025-10-14 08:11:09 UTC
I can confirm running into this same issue using the Qt6 build on openSUSE. Using ghostwriter 25.08.1, KF6.18.0, Qt 6.9.2, I initially encountered the error output:

"""
QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase
Aborted (core dumped)
"""

The error disappears and the application works as expected by uninstalling qt6-qtpbfimageformat from the system.
Comment 5 Martin Tůma 2025-10-14 10:07:48 UTC
Well, the broken code that does access the image plugins before QGuiApplication is created is still there in Ghostwriter, so no wonder Ghostwriter still terminates on this Qt assert...