Details
-
Type:
Bug
-
Status: Reported
-
Priority:
P2: Important
-
Resolution: Unresolved
-
Affects Version/s: 5.12, 5.15, 6.x
-
Fix Version/s: None
-
Component/s: GUI: Look'n'Feel
-
Labels:None
-
Platform/s:
Description
Hello,
consider the following code:
#include <QApplication> #include <QLabel> #include <dlfcn.h> int main(int argc, char** argv) { using gdk_init_check_ptr = void *(*)(int*, char***); auto gdk = dlopen("libgdk-x11-2.0.so.0", RTLD_LAZY | RTLD_LOCAL); auto gdk_init_check = (gdk_init_check_ptr)dlsym(gdk, "gdk_init_check"); gdk_init_check(nullptr, nullptr); QApplication app{argc, argv}; QLabel label{"foo"}; label.show(); return app.exec(); }
It will work fine if the QT_QPA_PLATFORMTHEME is not gtk3.
Otherwise, it either hangs (if gdk_init_check comes before QApplication) or crashes (if gdk_init_check comes after), likely because QGtk3 calls it too (through gtk_init).
Sadly qgtk3 is the default platform theme on Ubuntu means that's where are a lot of users.
What are my options to make sure that things work correctly no matter my user's platform themes ? My app loads external plug-ins from separate vendors and some require a GTK context to be initialized.