Bug 1215849 - libpbf.so crashes inside QFontDatabase constructor; can be reproduced by starting ghostwriter
Summary: libpbf.so crashes inside QFontDatabase constructor; can be reproduced by star...
Status: NEW
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Martin Tůma
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-01 08:33 UTC by Felix Niederwanger
Modified: 2024-04-22 14:16 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Niederwanger 2023-10-01 08:33:30 UTC
> $ ghostwriter SOMEFILE.md
> QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase
> [1]    8613 IOT instruction (core dumped)  ghostwriter SOMEFILE.md

I know that ghostwriter is broken now for some time (weeks), it was just today that I looked into what is broken.
Comment 1 Bruno Pitrus 2023-11-14 10:40:35 UTC
I have reproduced this crash with the following stack trace:

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f6235691e73 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f623563f0c6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f62356268d7 in __GI_abort () at abort.c:79
#4  0x00007f6235ebb51f in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1919
#5  QMessageLogger::fatal (this=this@entry=0x7ffdbbbb5fa0, msg=msg@entry=0x7f6236a31928 "QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase") at global/qlogging.cpp:898
#6  0x00007f6236526e60 in QFontDatabase::QFontDatabase (this=0x7ffdbbbb6000) at text/qfontdatabase.cpp:1446
#7  QFontDatabase::QFontDatabase (this=this@entry=0x7ffdbbbb6000) at text/qfontdatabase.cpp:1443
#8  0x00007f6221d2f005 in fonts () at src/font.cpp:62
#9  0x00007f6221d32345 in matchFamily (family=...) at src/font.cpp:101
#10 Font::fromJsonArray (json=...) at src/font.cpp:123
#11 0x00007f6221d2ae81 in Style::Layer::Layout::Layout (this=<optimized out>, json=..., this=<optimized out>, json=...) at src/style.cpp:369
#12 0x00007f6221d2cd85 in Style::Layer::Layer (this=<optimized out>, json=..., this=<optimized out>, json=...) at src/style.cpp:500
#13 0x00007f6221d35f5c in Style::load (this=<optimized out>, fileName=...) at src/style.cpp:598
#14 0x00007f6221d284af in PBFPlugin::PBFPlugin (this=<optimized out>, this=<optimized out>) at src/pbfplugin.cpp:16
#15 0x00007f6221d3ed35 in qt_plugin_instance () at /usr/src/debug/QtPBFImagePlugin-2.6/moc_pbfplugin.cpp:124
#16 0x00007f62360e3046 in QLibraryPrivate::pluginInstance (this=0x5570b3fadb30) at plugin/qlibrary.cpp:569
#17 0x00007f62360d6745 in QFactoryLoader::instance (this=this@entry=0x7f6236b31120 <QImageReaderWriterHelpers::(anonymous namespace)::Q_QGS_loader::innerFunction()::holder>, index=index@entry=18) at plugin/qfactoryloader.cpp:396
#18 0x00007f62365f40b3 in QImageReaderWriterHelpers::appendImagePluginMimeTypes (loader=0x7f6236b31120 <QImageReaderWriterHelpers::(anonymous namespace)::Q_QGS_loader::innerFunction()::holder>, cap=cap@entry=QImageIOPlugin::CanRead, 
    result=result@entry=0x7ffdbbbb6c80, resultKeys=resultKeys@entry=0x0) at image/qimagereaderwriterhelpers.cpp:91
#19 0x00007f62365f4ad3 in QImageReaderWriterHelpers::supportedMimeTypes (cap=cap@entry=QImageReaderWriterHelpers::CanRead) at image/qimagereaderwriterhelpers.cpp:143
#20 0x00007f62365ec8ef in QImageReader::supportedMimeTypes () at image/qimagereader.cpp:1595
#21 0x00005570b1ce7a8e in _sub_I_65535_0.0 ()
#22 0x00007f62356282ee in call_init (env=<optimized out>, argv=0x7ffdbbbb6d78, argc=1) at ../csu/libc-start.c:145
#23 __libc_start_main_impl (main=0x5570b1ce4140 <main(int, char**)>, argc=1, argv=0x7ffdbbbb6d78, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffdbbbb6d68) at ../csu/libc-start.c:347
#24 0x00005570b1ce7e85 in _start () at ../sysdeps/x86_64/start.S:115

The crash is inside libpbf.so which is an image format plugin to Qt. After uninstalling libqt5-qtpbfimageformat, ghostwriter starts up normally.

Reassigning this to the libqt5-qtpbfimageformat maintainer.
Comment 2 Martin Tůma 2023-11-15 11:26:56 UTC
This is not a bug in libqt5-qtpbfimageformat but a bug in ghostwriter which is broken in the exact way as the Qt assert it triggers says:

> Must construct a QGuiApplication before accessing QFontDatabase

In markdowneditor.cpp:179 ghostwriter calls the QImage API (through the static function buildImageReaderFormats() ) before QGuiApplication is created.
Comment 3 Felix Niederwanger 2023-11-21 10:04:58 UTC
I'm observing this issue only on Tumbleweed with qt6 installed. On another Tumbleweed without qt6, ghostwriter still works.

Also, yes this appears to be an issue in ghostwriter itself.
Comment 4 Martin Tůma 2023-11-22 18:28:12 UTC
This (at least if your stack trace is the same as the one posted by Bruno Pitrus) has nothing to do with Qt6. The trigger really is the libpbf.so Qt image plugin which is Qt5 only in Tumbleweed. Your two Tumbleweed installations will differ in the libqt5-qtpbfimageformat package being/not being installed.

But libpbf.so is just a trigger, not the problem. Any other Qt plugin (or even a newer Qt version) may trigger the ASSERT. You are simply not allowed to access any QtGui API before you construct a QGuiApplication which ghostwriter does, probably without it's developers even knowing - the static variables are inicialized before main().
Comment 5 Felix Niederwanger 2024-04-22 14:16:13 UTC
I also posted it on https://bugs.kde.org/show_bug.cgi?id=485962