From fac435ba9827b6d0fb522306e1a720a33f767f90 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 5 Feb 2020 00:24:14 +0100 Subject: [PATCH] widget: Fix a memory leak with class actions This code was doing the wrong thing even if the parent class doesn't have actions. --- gtk/gtkwidget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index d93b4b13a5..1ddee3026e 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -12957,9 +12957,9 @@ gtk_widget_class_add_action (GtkWidgetClass *widget_class, if (priv->actions == NULL) priv->actions = g_ptr_array_new (); - else if (GTK_IS_WIDGET_CLASS (&widget_class->parent_class)) + else { - GtkWidgetClass *parent_class = GTK_WIDGET_CLASS (&widget_class->parent_class); + GtkWidgetClass *parent_class = GTK_WIDGET_CLASS (g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (widget_class)))); GtkWidgetClassPrivate *parent_priv = parent_class->priv; GPtrArray *parent_actions = parent_priv->actions;