diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 2373843cef..c58406427a 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -125,7 +125,8 @@ enum static void gtk_statusbar_update (GtkStatusbar *statusbar, guint context_id, const gchar *text); -static void gtk_statusbar_destroy (GtkWidget *widget); + +static void gtk_statusbar_msg_free (GtkStatusbarMsg *msg); static guint statusbar_signals[SIGNAL_LAST] = { 0 }; @@ -136,6 +137,12 @@ gtk_statusbar_dispose (GObject *object) { GtkStatusbar *self = GTK_STATUSBAR (object); + g_slist_free_full (self->messages, (GDestroyNotify) gtk_statusbar_msg_free); + self->messages = NULL; + + g_slist_free_full (self->keys, g_free); + self->keys = NULL; + g_clear_pointer (&self->message_area, gtk_widget_unparent); G_OBJECT_CLASS (gtk_statusbar_parent_class)->dispose (object); @@ -149,7 +156,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class) object_class->dispose = gtk_statusbar_dispose; - widget_class->destroy = gtk_statusbar_destroy; widget_class->grab_focus = gtk_widget_grab_focus_none; widget_class->focus = gtk_widget_focus_child; @@ -503,17 +509,3 @@ gtk_statusbar_get_message (GtkStatusbar *statusbar) return gtk_label_get_label (GTK_LABEL (statusbar->label)); } - -static void -gtk_statusbar_destroy (GtkWidget *widget) -{ - GtkStatusbar *statusbar = GTK_STATUSBAR (widget); - - g_slist_free_full (statusbar->messages, (GDestroyNotify) gtk_statusbar_msg_free); - statusbar->messages = NULL; - - g_slist_free_full (statusbar->keys, g_free); - statusbar->keys = NULL; - - GTK_WIDGET_CLASS (gtk_statusbar_parent_class)->destroy (widget); -}