Skip to content

xed 3.8.9 hangs at startup when GTK4 is installed: Python plugins load Gtk-4.0 typelib into a GTK3 process #757

Description

@slawern

Description

On my system where both GTK3 and GTK4 are installed, xed hangs at startup and never shows a window. The process does not crash and produces no core dump.

It seems xed's bundled Python plugins import gi.repository.Gtk, Gdk and GtkSource without calling gi.require_version() for those namespaces. PyGObject then resolves each one to the highest available typelib — Gtk-4.0, Gdk-4.0 — and libgtk-4.so.1 is dlopen()ed into a process that already has libgtk-3.so.0 loaded.

Both libraries register GObject types under the same names. The second registration fails:

g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
g_once_init_leave_pointer: assertion 'result != 0' failed
g_type_get_qdata: assertion 'node != NULL' failed

g_boxed_type_register_static() returns 0, so g_once_init_leave_pointer() aborts on its assertion before releasing the one-time initialization lock. Every subsequent g_once_init_enter() on that address blocks forever, which is the hang.

Steps to reproduce

  1. Install GTK4 alongside GTK3. GTK4 does not need to be used by anything — its presence alone provides Gtk-4.0.typelib.
  2. Build/install xed with the libpeas Python 3 loader enabled.
  3. Run xed from a terminal.

Expected behaviour

xed starts normally.

Actual behaviour

The three GLib assertion warnings above are printed, then the process hangs indefinitely. No window appears.

Evidence

Both GTK versions are mapped into the process:

$ xed & sleep 5; grep -E 'libgtk-(3|4)' /proc/$(pgrep -n xed)/maps | awk '{print $6}' | sort -u
/usr/lib64/libgtk-3.so.0.2420.32
/usr/lib64/libgtk-4.so.1.2000.4

Removing the libpeas Python loader makes xed start correctly:

$ mv /usr/lib64/libpeas-1.0/loaders/libpython3loader.so /usr/lib64/libpeas-1.0/loaders/libpython3loader.so.OFF
$ xed
(xed): libpeas-WARNING **: Failed to load module 'python3loader'
(xed): libpeas-WARNING **: Could not load plugin loader 'python3'
** (xed): WARNING **: Failed to load builtin plugin: Join Lines
** (xed): WARNING **: Failed to load builtin plugin: Text Size
** (xed): WARNING **: Failed to load builtin plugin: Open URI

xed then starts and works, minus the Python plugins.

Environment

  • Gentoo Linux (systemd), Cinnamon on X11
  • xed: 3.8.9
  • GTK3: libgtk-3.so.0.2420.32
  • GTK4: libgtk-4.so.1.2000.4
  • libpeas: 1.38.1
  • gtksourceview: 4 (libgtksourceview-4.so.0.0.0)
  • Python: 3.14
  • PyGObject: 3.56.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions