[libdazzle] progress-menu-button: try harder to avoid spinning



commit 2aefe60fb48ac4fa02b2dc83f98558e37d0b4a83
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 22 18:21:35 2017 -0800

    progress-menu-button: try harder to avoid spinning
    
    We can get into a state where we'd async-spin here because if
    the widget doesn't have an allocation. This protects against
    that so we don't 100% cpu spin.

 src/widgets/dzl-progress-menu-button.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/widgets/dzl-progress-menu-button.c b/src/widgets/dzl-progress-menu-button.c
index 4a37913..e888a21 100644
--- a/src/widgets/dzl-progress-menu-button.c
+++ b/src/widgets/dzl-progress-menu-button.c
@@ -116,10 +116,14 @@ static gboolean
 begin_theatrics_from_main (gpointer user_data)
 {
   DzlProgressMenuButton *self = user_data;
+  GtkAllocation rect;
 
   g_assert (DZL_IS_PROGRESS_MENU_BUTTON (self));
 
-  dzl_progress_menu_button_begin_theatrics (self);
+  /* Ignore if still ont allocated */
+  gtk_widget_get_allocation (GTK_WIDGET (self), &rect);
+  if (rect.x != -1 && rect.y != -1)
+    dzl_progress_menu_button_begin_theatrics (self);
 
   return G_SOURCE_REMOVE;
 }


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