[next] telepathy-glib: tp_proxy_dispose: be actually idempotent

Simon McVittie smcv at kemper.freedesktop.org
Fri Mar 14 12:02:34 PDT 2014


Module: telepathy-glib
Branch: next
Commit: b6bf79f143f1b7ec98f03c3fd20d8eb269dc71d8
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=b6bf79f143f1b7ec98f03c3fd20d8eb269dc71d8

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Mar 11 19:23:17 2014 +0000

tp_proxy_dispose: be actually idempotent

The "dispose_has_run" anti-pattern would prevent us from cleaning up
properly if the object went down to 0 refs, was resurrected (however
inappropriately) by being reffed in a weak-ref callback, and was used
again.

That doesn't currently matter, because all our cleanup is currently
in tp_proxy_emit_invalidated(), called from tp_proxy_invalidate(),
whose use from tp_proxy_dispose() is already a design flaw... but
one day I'd like to stop relying on that.

---

 telepathy-glib/proxy.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index 8db1cf4..ed57d80 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -383,8 +383,6 @@ struct _TpProxyPrivate {
      * completed */
     guint pending_will_announce_calls;
 
-    gboolean dispose_has_run;
-
     TpClientFactory *factory;
 };
 
@@ -1114,10 +1112,6 @@ tp_proxy_dispose (GObject *object)
   GError e = { TP_DBUS_ERRORS, TP_DBUS_ERROR_PROXY_UNREFERENCED,
       "Proxy unreferenced" };
 
-  if (self->priv->dispose_has_run)
-    return;
-  self->priv->dispose_has_run = TRUE;
-
   DEBUG ("%p", self);
 
   tp_proxy_invalidate (self, &e);



More information about the telepathy-commits mailing list