wayland: Handle dispatch failing in a couple of more places
authorJonas Ådahl <jadahl@gmail.com>
Sat, 11 Feb 2023 10:42:21 +0000 (11:42 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Sat, 11 Feb 2023 10:42:21 +0000 (11:42 +0100)
Without doing this, we'll end up with risking GTK processes sitting
eating 100% CPU instead of just exit(1):ing.

gdk/wayland/gdkpopup-wayland.c
gdk/wayland/gdktoplevel-wayland.c

index 652cac8ef7d03c4ccb6ce9c461a1a9df76a76c9b..125e70e638c26232725c5f22000cb356a02cdbd5 100644 (file)
@@ -1388,7 +1388,15 @@ gdk_wayland_surface_present_popup (GdkWaylandPopup *wayland_popup,
     }
 
   while (wayland_popup->display_server.xdg_popup && !is_relayout_finished (surface))
-    wl_display_dispatch_queue (display_wayland->wl_display, wayland_surface->event_queue);
+    {
+      if (wl_display_dispatch_queue (display_wayland->wl_display,
+                                     wayland_surface->event_queue) == -1)
+        {
+          g_message ("Error %d (%s) dispatching to Wayland display.",
+                     errno, g_strerror (errno));
+          _exit (1);
+        }
+    }
 
   if (wayland_popup->display_server.xdg_popup)
     {
index bdaca587f9645a84ff355ff9964c21a3a68da96a..7a74967c8d1afb9f4369096c9f18d393146d1374 100644 (file)
@@ -2119,7 +2119,15 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel,
           xdg_activation_token_v1_commit (token);
 
           while (startup_id == NULL)
-            wl_display_dispatch_queue (display_wayland->wl_display, event_queue);
+            {
+              if (wl_display_dispatch_queue (display_wayland->wl_display,
+                                             event_queue) == -1)
+                {
+                  g_message ("Error %d (%s) dispatching to Wayland display.",
+                             errno, g_strerror (errno));
+                  _exit (1);
+                }
+            }
 
           xdg_activation_token_v1_destroy (token);
           wl_event_queue_destroy (event_queue);