QFontDatabase causes Segfault [Solved]
-
Did you set these flags your self or use Qt Creator Run in debug mode ?
-
Try again with
CONFIG+=debug
. You currently build a debug version of your app running against a release build of Qt.You might not be using mutex directly but depending on what part of Qt you use, Qt is.
-
Try again with
CONFIG+=debug
. You currently build a debug version of your app running against a release build of Qt.You might not be using mutex directly but depending on what part of Qt you use, Qt is.
-
Do you have the Qt debug package for your distribution installed ?
-
@SGaist I've just installed
qtbase5-dbg
to make sure, but the result remains the same.Anyway, do we really need to get more information about what exactly is causing the segmentation fault in
QFontDatabase::QFontDatabase
? It seems that almost anything in<QFontDatabase>
causes a segmentation fault. Well, at leastQFontDatabase::QFontDatabase
andQFontDatabase::addApplicationFont
do. -
Wait, Valgrind seems to be more accurate than the stack trace for some reason.
==2786== at 0x672E3FA: initializeDb() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.2.1) ==2786== by 0x672E460: QFontDatabase::QFontDatabase() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.2.1)
I don't know how to get more info.
-
When are you using it in your application ?
-
int main(int argc, char *argv[]) { DS::Initialize(); \\ ... }
where
DS::Initialize
is a static function of the classDS
:void DS::Initialize(void) { struct sigaction act; sigemptyset(&act.sa_mask); act.sa_handler = ::Handler; act.sa_flags = 0; sigaction(SIGSEGV, &act, 0); QFontDatabase k; std::cout << "foo" << std::endl; auto s = QFontDatabase::addApplicationFont("construct/Type.ttf"); std::cout << "foo" << std::endl; \\ ... }
-
You're missing a QGuiApplication in order to use QFontDatabase
-
You're welcome !
Just edit the thread title a prepend it or rather [solved] so that the forum can pick it up and modify the view accordingly :)