[gimp] libgimpwidgets: do not assume a GimpFrame has a child.



commit 7448c7f811338a96aa45ecaf139ab47680b8eecd
Author: Jehan <jehan girinstud io>
Date:   Mon Sep 10 16:26:54 2018 +0200

    libgimpwidgets: do not assume a GimpFrame has a child.
    
    This fixes 2 CRITICALs when creating a GimpFrame without a child. There
    are reasons to create empty frames (for instance to conditionnally add
    contents later, and use it as a label only otherwise).

 libgimpwidgets/gimpframe.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libgimpwidgets/gimpframe.c b/libgimpwidgets/gimpframe.c
index c97364ee38..043be2152f 100644
--- a/libgimpwidgets/gimpframe.c
+++ b/libgimpwidgets/gimpframe.c
@@ -168,8 +168,11 @@ gimp_frame_child_notify (GimpFrame *frame)
 {
   GtkWidget *child = gtk_bin_get_child (GTK_BIN (frame));
 
-  gtk_widget_set_margin_start (child, gimp_frame_get_indent (frame));
-  gtk_widget_set_margin_top (child, gimp_frame_get_label_spacing (frame));
+  if (child)
+    {
+      gtk_widget_set_margin_start (child, gimp_frame_get_indent (frame));
+      gtk_widget_set_margin_top (child, gimp_frame_get_label_spacing (frame));
+    }
 }
 
 static gint


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