[gtk+] scrolled window: Avoid a crash



commit 3a671994d4f4de61a48df6198353a188b7862baa
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 20 08:24:47 2015 -0500

    scrolled window: Avoid a crash
    
    gtk_scrolled_window_allocate_scrollbar was calling
    gtk_scrolled_window_allocate_child just to get the relative
    allocation, overlooking the fact that that function is only
    safe to call if the scrolled window _has_ a child. Unfortunately,
    gtk_scrolled_window_allocate_scrollbar will sometimes get called
    when that is not the case. Since we are really only interested
    in the relative allocation, just get that directly. This
    fixes a segfault in the style-properties-nth-child reftest.

 gtk/gtkscrolledwindow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 39dddc9..b3f3770 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2494,7 +2494,7 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  gtk_scrolled_window_allocate_child (scrolled_window, &content_allocation);
+  gtk_scrolled_window_relative_allocation (widget, &content_allocation);
   sb_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
   gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
   gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);


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