[gtk+/gtk-3-10] Fix possible crash in header bar



commit 4e060e6efe80f8a9b02de1291c0492868b2b9315
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 27 17:06:01 2013 +0200

    Fix possible crash in header bar
    
    When the header bar's top-level widget is not a GtkWindow,
    don't try to get the inexistant "decoration-button-layout"
    property.

 gtk/gtkheaderbar.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 4a0481a..412b27c 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -650,12 +650,15 @@ gtk_header_bar_get_preferred_height_for_width (GtkWidget *widget,
 static gboolean
 close_button_at_end (GtkWidget *widget)
 {
+  GtkWidget *toplevel;
   gchar *layout_desc;
   gboolean at_end;
   gchar *p;
 
-  gtk_widget_style_get (gtk_widget_get_toplevel (widget),
-                        "decoration-button-layout", &layout_desc, NULL);
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    return TRUE;
+  gtk_widget_style_get (toplevel, "decoration-button-layout", &layout_desc, NULL);
 
   p = strchr (layout_desc, ':');
   if (p && strstr (p, "close"))


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