diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-04-13 13:57:10 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-04-13 13:57:10 +0100 |
commit | dc6a74fee04e3fad668b23e84c62b394cb27adc8 (patch) | |
tree | 920d7870bf3e255ee793f43eaabf9038104024a7 /plugins | |
parent | d6f73b4b2db4b4751a41d85a69442438c4dbb67c (diff) |
test plugin: don't ref connection from channel manager
If the test plugin's channel manager holds a reference to the
connection, we have a cycle: the connection owns a reference to each
channel manager. TpBaseConnection only releases its channel managers
when it's disposed, which in this case is never.
(All the other channel managers do the right thing.)
Fixes: <https://bugs.freedesktop.org/show_bug.cgi?id=36179>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/test.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/plugins/test.c b/plugins/test.c index ab9ec82af..678df2d8f 100644 --- a/plugins/test.c +++ b/plugins/test.c @@ -505,7 +505,10 @@ test_channel_manager_set_property ( switch (property_id) { case PROP_CONNECTION: - self->connection = g_value_dup_object (value); + /* Not reffing this: the connection owns all channel managers, so it + * must outlive us. Taking a reference leads to a cycle. + */ + self->connection = g_value_get_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -555,17 +558,6 @@ test_channel_manager_constructed (GObject *object) } static void -test_channel_manager_dispose (GObject *object) -{ - TestChannelManager *self = TEST_CHANNEL_MANAGER (object); - - if (G_OBJECT_CLASS (test_channel_manager_parent_class)->dispose != NULL) - G_OBJECT_CLASS (test_channel_manager_parent_class)->dispose (object); - - tp_clear_object (&self->connection); -} - -static void test_channel_manager_class_init (TestChannelManagerClass *klass) { GObjectClass *oclass = G_OBJECT_CLASS (klass); @@ -573,7 +565,6 @@ test_channel_manager_class_init (TestChannelManagerClass *klass) oclass->set_property = test_channel_manager_set_property; oclass->get_property = test_channel_manager_get_property; oclass->constructed = test_channel_manager_constructed; - oclass->dispose = test_channel_manager_dispose; g_object_class_install_property (oclass, PROP_CONNECTION, g_param_spec_object ("connection", "Gabble Connection", |