Bug 477413 - Ghostwriter core dump if qt5-qtpbfimageformat is installed
Summary: Ghostwriter core dump if qt5-qtpbfimageformat is installed
Status: REOPENED
Alias: None
Product: ghostwriter
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR grave
Target Milestone: ---
Assignee: megan.conkle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-23 11:32 UTC by Tom
Modified: 2024-07-19 07:19 UTC (History)
3 users (show)

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


Attachments
gdb /usr/bin/ghostwriter 2>&1 | tee ~/ghostwriter.log (28.73 KB, text/x-log)
2023-11-23 11:32 UTC, Tom
Details

Note You need to log in before you can comment on or make changes to this bug.
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.