[gnome-builder/wip/greeter] egg-signal-group: connect_object() handles dispose case, so we can ignore
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/greeter] egg-signal-group: connect_object() handles dispose case, so we can ignore
- Date: Mon, 11 May 2015 06:24:58 +0000 (UTC)
commit 24d506ef5a879889b267664e9512c90121acc1d2
Author: Christian Hergert <christian hergert me>
Date: Sun May 10 23:24:51 2015 -0700
egg-signal-group: connect_object() handles dispose case, so we can ignore
We won't necessarily be able to disconnect during dispose, since
connect_object() will handle this for us. So just silently drop the
handler in such a case.
contrib/egg/egg-signal-group.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/contrib/egg/egg-signal-group.c b/contrib/egg/egg-signal-group.c
index 77eddd4..70042d1 100644
--- a/contrib/egg/egg-signal-group.c
+++ b/contrib/egg/egg-signal-group.c
@@ -52,6 +52,7 @@ struct _EggSignalGroup
GPtrArray *handlers;
GType target_type;
gsize block_count;
+ guint disposing;
};
struct _EggSignalGroupClass
@@ -200,7 +201,12 @@ egg_signal_group_unbind (EggSignalGroup *self)
handler_id = handler->handler_id;
handler->handler_id = 0;
- g_signal_handler_disconnect (target, handler_id);
+ /*
+ * If we are disposing, g_signal_connect_object() is already taking
+ * care of the disconnect for us. So ignore that case.
+ */
+ if (self->disposing == 0)
+ g_signal_handler_disconnect (target, handler_id);
}
g_signal_emit (self, gSignals [UNBIND], 0);
@@ -352,10 +358,14 @@ egg_signal_group_dispose (GObject *object)
{
EggSignalGroup *self = (EggSignalGroup *)object;
+ self->disposing++;
+
egg_signal_group_unbind (self);
g_clear_pointer (&self->handlers, g_ptr_array_unref);
G_OBJECT_CLASS (egg_signal_group_parent_class)->dispose (object);
+
+ self->disposing--;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]