[gtk+/gtk-3-10] overlay: deal gracefully with main widget being absent



commit 6d7837885f764bddcc83444f0d92e8293abd9a60
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 5 11:21:50 2014 -0400

    overlay: deal gracefully with main widget being absent
    
    It can happen that we get a size request when the main widget
    is still NULL. Currently we hit a critical in this case, and
    stumble on. We can do better.
    Opening a new tab in nautilus is hitting this case.
    https://bugzilla.gnome.org/show_bug.cgi?id=727643

 gtk/gtkoverlay.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 59eefbf..76639b7 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -206,13 +206,20 @@ gtk_overlay_get_main_widget_allocation (GtkOverlay *overlay,
       main_alloc.width = gtk_widget_get_allocated_width (grandchild);
       main_alloc.height = gtk_widget_get_allocated_height (grandchild);
     }
-  else
+  else if (GTK_IS_WIDGET (main_widget))
     {
       main_alloc.x = 0;
       main_alloc.y = 0;
       main_alloc.width = gtk_widget_get_allocated_width (main_widget);
       main_alloc.height = gtk_widget_get_allocated_height (main_widget);
     }
+  else
+    {
+      main_alloc.x = 0;
+      main_alloc.y = 0;
+      main_alloc.width = 1;
+      main_alloc.height = 1;
+    }
 
   if (main_alloc_out)
     *main_alloc_out = main_alloc;


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