Closed jcelerier closed 1 year ago
Apologies for the late reply.
I'm not sure. IIRC the expectation here is that a Qt app shouldn't have called gtk_init
itself. An idempotent version of gtk_init
would be nice, but there doesn't seem to be one.
What host is this happening in, and why does it initialize Gtk itself?
No worries !
I'm not sure. IIRC the expectation here is that a Qt app shouldn't have called gtk_init itself.
Qt on e.g. Ubuntus is configured to use the qgtk3 platform plug-in which makes the Qt apps fit with the GTK look and feel of the system (and thus needs to call GTK functions, thus the gtk_init call) - this is outside of the host's control.
$ gdb kate # or any GUI Qt app
(gdb) b gtk_init
Function "gtk_init" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (gtk_init) pending.
(gdb) r
Starting program: /usr/bin/kate
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fecf587a700 (LWP 5973)]
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Thread 1 "kate" hit Breakpoint 1, 0x00007fecf4a88db0 in gtk_init () from /lib/x86_64-linux-gnu/libgtk-3.so.0
(gdb) bt
#0 0x00007fecf4a88db0 in gtk_init () from /lib/x86_64-linux-gnu/libgtk-3.so.0
#1 0x00007fecf500737f in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#2 0x00007fecf5001783 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#3 0x00007fecfaa64868 in QPlatformThemeFactory::create(QString const&, QString const&) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#4 0x00007fecfaa6e200 in QGuiApplicationPrivate::createPlatformIntegration() () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#5 0x00007fecfaa6f708 in QGuiApplicationPrivate::createEventDispatcher() () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#6 0x00007fecfa54af55 in QCoreApplicationPrivate::init() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#7 0x00007fecfaa71543 in QGuiApplicationPrivate::init() () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#8 0x00007fecfb0ae3bd in QApplicationPrivate::init() () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9 0x0000557f2914ed17 in ?? ()
#10 0x00007fecf9f0e083 in __libc_start_main (main=0x557f2914ec50, argc=1, argv=0x7ffe703cf768, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe703cf758) at ../csu/libc-start.c:308
#11 0x0000557f2915259e in _start ()
(gdb)
Ah. Fuunn. I vaguely remember trying to find a way to conditionally call gtk_init but coming up dry. I guess, worst case scenario, there must be some kludge that will tell if it's been called.
Anyway, good to know what the source of the issue is. Thanks for the report, I'll try to look into it.
I'm seeing potentially the same issue in Ardour 6.9 on Debian bookworm.
See thread here: https://discourse.ardour.org/t/lv2-plugins-causing-gui-freeze-debian-testing/107552/2
That's not this issue. As described above, this issue is specific to Qt5 hosts embedding Gtk plugin UIs when the user is using a Qt theme that uses a Gtk engine internally.
I have removed the wrappers which caused this issue: ad39b43
Sorry if this case is important to you, but Gtk plugin UIs will no longer work in Qt hosts at all, or at least not magically via suil. Gtk2 is EOL, has always been discouraged for plugin UIs (for good reasons we can't do anything about), and in practice this doesn't affect much except Calf (which is unmaintained) in Qt hosts.
fair enough, thanks !
Hi, I'm having some issue with the following case:
On Ubuntu 20.04, by default, Qt uses the qgtk3 platform theme which calls gtk_init.
But when I try to show a calf UI:
with the following stack trace:
what is the correct thing to do in that case ?