gdksurface-wayland: Fix contradictory assert
authorKritphong Mongkhonvanit <kritphong@mongkhonvanit.tk>
Mon, 17 Jan 2022 06:33:46 +0000 (01:33 -0500)
committerKritphong Mongkhonvanit <kritphong@mongkhonvanit.tk>
Mon, 17 Jan 2022 08:50:08 +0000 (15:50 +0700)
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.

gdk/wayland/gdksurface-wayland.c

index 93498d7cb5df509bff232f4ba7afe935f6b4e069..7476c6a4456bca5e93a20f9585bf6665b3287281 100644 (file)
@@ -2293,8 +2293,7 @@ gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel)
 
   if (!wayland_toplevel->idle_inhibitor)
     {
-      g_assert (wayland_toplevel->idle_inhibitor &&
-                wayland_toplevel->idle_inhibitor_refcount > 0);
+      g_assert (wayland_toplevel->idle_inhibitor_refcount == 0);
 
       wayland_toplevel->idle_inhibitor =
           zwp_idle_inhibit_manager_v1_create_inhibitor (display_wayland->idle_inhibit_manager,