[gtk/wip/chergert/gtk4-gtk-main-sync: 1/2] gtkmain: short-circuit gtk_main_sync() where no display



commit 4a7f68e79e0c2a56eb1297e72a33cbdcd68418ba
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 10 15:00:10 2020 -0800

    gtkmain: short-circuit gtk_main_sync() where no display
    
    If there is no display, we will hit the slow path here which
    can introduce long latencies in unit tests. This checks for
    a NULL list of displays and simply short-circuits.

 gtk/gtkmain.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index fe5868a95d..93fea8540a 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1081,6 +1081,9 @@ gtk_main_sync (void)
   
   /* Try storing all clipboard data we have */
   displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+  if (displays == NULL)
+    return;
+
   cancel = g_cancellable_new ();
 
   for (l = displays; l; l = l->next)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]