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.
This commit is contained in:
Christian Hergert 2020-01-10 15:00:10 -08:00
parent f0cbd175cd
commit 4a7f68e79e

View File

@ -1081,6 +1081,9 @@ gtk_main_sync (void)
/* Try storing all clipboard data we have */ /* Try storing all clipboard data we have */
displays = gdk_display_manager_list_displays (gdk_display_manager_get ()); displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
if (displays == NULL)
return;
cancel = g_cancellable_new (); cancel = g_cancellable_new ();
for (l = displays; l; l = l->next) for (l = displays; l; l = l->next)