Bug 20946

Summary: Closed D-Bus and GObject signals fired together make code nasty
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Guillaume Desmottes 2009-03-30 06:29:25 UTC
Channels have to fire the D-Bus Closed signal when disposing (if the channel was not already closed of course). Most of the channel managers catch the GObject closed signal so they can drop their ref when the channel has been closed.

Currently all the channels mgr do this kind of trick when closing all the channels:
      GHashTable *tmp = priv->tubes_channels;
      priv->tubes_channels = NULL;
      g_hash_table_destroy (tmp);

So the closed callback knows we are disposing and do nothing.

We could avoid these hacks by not firing the GObject signal when disposing.  
Unfortunately that's currently not possible.
Comment 1 Simon McVittie 2009-04-23 09:42:24 UTC
Can't fix. dbus-glib emits (D-Bus) Closed as a side-effect of (GObject) closed.
Comment 2 Will Thompson 2009-07-27 06:23:47 UTC
After further thought, I think the correct fix here is to change:

      GHashTable *tmp = priv->tubes_channels;
      priv->tubes_channels = NULL;
      g_hash_table_destroy (tmp);

into:

      GList *cs = g_hash_table_get_values (priv->tubes_channels);
      for (TubeChannel *c in cs)
          tube_channel_close (c);
      g_list_free (cs);
      g_assert (g_hash_table_size (priv->tubes_channels) == 0);

The issue is in conflating unreffing the channel with telling it to close. INVALID?
Comment 3 GitLab Migration User 2019-12-03 19:23:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/12.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.