[gtk+/wip/baedert/drawing: 15/23] widget: Fix priv dereference in size_allocate_with_baseline



commit 88c4a2d6fece0e61b300288a4a1265e3fa49ecf0
Author: Timm Bäder <mail baedert org>
Date:   Sun Jul 9 16:42:19 2017 +0200

    widget: Fix priv dereference in size_allocate_with_baseline
    
    Accessing ->priv is only safe *after* the GTK_IS_WIDGET precondition, so
    use the get_instance_private function instead.

 gtk/gtkwidget.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 867e2a6..ed0a34c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5381,7 +5381,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
                                        GtkAllocation *allocation,
                                        gint           baseline)
 {
-  GtkWidgetPrivate *priv;
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GdkRectangle real_allocation;
   GdkRectangle old_allocation, old_clip;
   GdkRectangle adjusted_allocation;
@@ -5395,8 +5395,6 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
   GtkCssStyle *style;
   GtkBorder margin, border, padding;
 
-  priv = widget->priv;
-
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   if (!priv->visible && !_gtk_widget_is_toplevel (widget))


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