[gtk+/refactor: 139/145] gtkrange: Add some checks to gtk_range_set_slider_size_fixed()



commit 903a97797ccce0e67a00f606f2a421a7c5f09ef5
Author: Javier Jardón <jjardon gnome org>
Date:   Fri Aug 13 17:06:10 2010 +0200

    gtkrange: Add some checks to gtk_range_set_slider_size_fixed()
    
    Recalculate layout only if the range is already mapped and
    adjustment is not NULL.

 gtk/gtkrange.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 7d4a36b..b698b34 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -961,9 +961,12 @@ gtk_range_set_slider_size_fixed (GtkRange *range,
     {
       range->slider_size_fixed = size_fixed ? TRUE : FALSE;
 
-      range->need_recalc = TRUE;
-      gtk_range_calc_layout (range, range->adjustment->value);
-      gtk_widget_queue_draw (GTK_WIDGET (range));
+      if (range->adjustment && gtk_widget_get_mapped (GTK_WIDGET (range)))
+        {
+          range->need_recalc = TRUE;
+          gtk_range_calc_layout (range, gtk_adjustment_get_value (range->adjustment));
+          gtk_widget_queue_draw (GTK_WIDGET (range));
+        }
     }
 }
 



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