[gtk/kjellahl/gtkheaderbar-signal-handlers] headerbar: Disconnect signal handlers when children are removed
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/kjellahl/gtkheaderbar-signal-handlers] headerbar: Disconnect signal handlers when children are removed
- Date: Wed, 13 Nov 2019 14:23:33 +0000 (UTC)
commit bc97fe3b2578213d103fc57fcc6c9dfe8a1e9b01
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Nov 13 15:20:34 2019 +0100
headerbar: Disconnect signal handlers when children are removed
The signal handler that calls notify_child_cb() is disconnected
from a child widget before the child is removed from the header bar.
gtk_header_bar_dispose() chains up before destroying the start and end
boxes, thus avoiding calls to notify_child_cb() after start_box and
end_box have been cleared.
Fixes #2246
gtk/gtkheaderbar.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 7141a2d300..582c945c4c 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -818,10 +818,11 @@ gtk_header_bar_dispose (GObject *object)
g_clear_pointer (&priv->custom_title, gtk_widget_unparent);
g_clear_pointer (&priv->label_box, gtk_widget_unparent);
- g_clear_pointer (&priv->start_box, gtk_widget_unparent);
- g_clear_pointer (&priv->end_box, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_header_bar_parent_class)->dispose (object);
+
+ g_clear_pointer (&priv->start_box, gtk_widget_unparent);
+ g_clear_pointer (&priv->end_box, gtk_widget_unparent);
}
static void
@@ -981,11 +982,13 @@ gtk_header_bar_remove (GtkContainer *container,
if (parent == priv->start_box)
{
+ g_signal_handlers_disconnect_by_func (widget, notify_child_cb, bar);
gtk_container_remove (GTK_CONTAINER (priv->start_box), widget);
removed = TRUE;
}
else if (parent == priv->end_box)
{
+ g_signal_handlers_disconnect_by_func (widget, notify_child_cb, bar);
gtk_container_remove (GTK_CONTAINER (priv->end_box), widget);
removed = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]