Skip to content

gdksurface-wayland: Fix contradictory assert

gdk_wayland_toplevel_inhibit_idle() contained a contradictory assert that always fail. More specifically, in the branch that is supposed to create the idle inhibitor, there is an assertion that it must already exist and that the refcount must be greater than zero. This causes a crash on WMs/DEs that use the ZWP idle inhibit manager protocol such as KDE Plasma and Sway. Fix this by just asserting that the refcount is zero instead.

Test case (not reproducible on GNOME):

import gi
gi.require_version("Gdk", "4.0")                                                
gi.require_version("Gtk", "4.0")                                                
from gi.repository import Gdk, Gtk

def handle_activate(app):
    win = Gtk.ApplicationWindow(application=app)
    win.set_default_size(480, 480)
    win.present()

    Gtk.Application.inhibit(app, win, Gtk.ApplicationInhibitFlags.IDLE, "")

app = Gtk.Application(application_id="com.example.Test")
app.connect("activate", handle_activate)
app.run(None)

Merge request reports