Skip to content

GTK/X11 crashes from GTK calls inside @async_function worker threads #409

Description

@ebey317

Hypnotix 4.3 has GTK thread-safety violations that can crash on X11.

Environment:

  • Linux Mint Cinnamon X11
  • Hypnotix 4.3
  • Python 3.10.12
  • GTK 3.24.33

Symptoms:

  • Channel selection can crash with:
    Gdk-ERROR: received X Window System error
    BadRequest (invalid request code or no such operation)
    request_code 0 minor_code 0
  • Launching from desktop icon can abort with SIGABRT/SIGTRAP.
  • coredumps show crashes in libgdk/libX11/cairo while Python worker threads are active.

Root causes found:

  1. LiveMainWindow.play_async is decorated with @async_function but calls GTK/GDK-sensitive code:

    • self.info_menu_item.set_sensitive(False)
    • self.before_play(channel)
    • self.reinit_mpv()
    • self.mpv_drawing_area.get_window().get_xid()
  2. LiveMainWindow.reload is decorated with @async_function; in the Xtream provider path it directly calls GTK/GDK window cursor APIs from the worker thread:

    • self.window.get_window().get_cursor()
    • self.window.get_window().set_cursor(...)
    • Gdk.Cursor.new_from_name(...)

GTK must only be touched from the GTK main loop.

Proposed fixes:

  • Keep GTK setup and mpv window/XID creation on the main thread.
  • Move only blocking/network/wait operations to worker threads.
  • Marshal cursor changes through GLib.idle_add / the existing @idle_function.

Patch direction:

  • Remove @async_function from play_async.
  • Move only mpv.wait_until_playing() into a worker helper.
  • Add idle-thread helpers for Xtream wait cursor set/restore.

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