[gtk+] scale: Avoid a crash



commit 38f71172f89d4f80a5d852a7b822bb944ba82934
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 15 14:18:09 2016 -0400

    scale: Avoid a crash
    
    gtk_scale_get_layout was not careful enough, leading to a crash
    when opening the inspector on a scale.

 gtk/gtkscale.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index fc0121d..6d71292 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1901,12 +1901,11 @@ gtk_scale_get_layout (GtkScale *scale)
 
   priv = scale->priv;
 
-  if (!priv->layout)
+  if (!priv->layout && priv->draw_value)
     {
       int min_layout_width;
 
-      if (priv->draw_value)
-        priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (scale), NULL);
+      priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (scale), NULL);
 
       gtk_css_gadget_get_preferred_size (priv->value_gadget,
                                          GTK_ORIENTATION_HORIZONTAL, -1,


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