diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-11-16 14:23:13 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-11-16 14:23:13 +0000 |
commit | 11bcaaa002b82bf16ef0051f77dc2da0e946b3ad (patch) | |
tree | df71a7b6b89f4eec777351d2e04a7322c3820e18 | |
parent | e1dbadd08dea266abfba27ec57a53a974539be3e (diff) | |
download | telepathy-salut-11bcaaa002b82bf16ef0051f77dc2da0e946b3ad.tar.gz |
Revert "Remove deprecated tp_handle_ref/unref"
This reverts commit c452d94fabbdf31c85963c81df3d5d566148f968.
-rw-r--r-- | src/avahi-olpc-activity-manager.c | 9 | ||||
-rw-r--r-- | src/avahi-olpc-activity.c | 1 | ||||
-rw-r--r-- | src/capability-set.c | 1 | ||||
-rw-r--r-- | src/contact.c | 31 | ||||
-rw-r--r-- | src/muc-manager.c | 2 | ||||
-rw-r--r-- | src/olpc-activity.c | 12 | ||||
-rw-r--r-- | src/self.c | 11 | ||||
-rw-r--r-- | src/tube-dbus.c | 25 | ||||
-rw-r--r-- | src/tube-stream.c | 9 | ||||
-rw-r--r-- | src/tubes-channel.c | 15 |
10 files changed, 115 insertions, 1 deletions
diff --git a/src/avahi-olpc-activity-manager.c b/src/avahi-olpc-activity-manager.c index 8d3691bc..94da8718 100644 --- a/src/avahi-olpc-activity-manager.c +++ b/src/avahi-olpc-activity-manager.c @@ -183,6 +183,7 @@ browser_found (GaServiceBrowser *browser, salut_olpc_activity_manager_contact_joined (mgr, contact, activity); g_object_unref (activity); + tp_handle_unref (room_repo, room); g_free (contact_name); g_free (room_name); g_object_unref (contact); @@ -232,13 +233,18 @@ browser_removed (GaServiceBrowser *browser, DEBUG ("Invalid contact name %s: %s", contact_name, error->message); g_error_free (error); g_free (contact_name); + tp_handle_unref (room_repo, room); return; } g_free (contact_name); activity = salut_olpc_activity_manager_get_activity_by_room (mgr, room); + tp_handle_unref (room_repo, room); if (activity == NULL) - return; + { + tp_handle_unref (contact_repo, contact_handle); + return; + } salut_avahi_olpc_activity_remove_service (SALUT_AVAHI_OLPC_ACTIVITY (activity), interface, protocol, name, type, domain); @@ -249,6 +255,7 @@ browser_removed (GaServiceBrowser *browser, contact = salut_contact_manager_get_contact (contact_manager, contact_handle); + tp_handle_unref (contact_repo, contact_handle); g_object_unref (contact_manager); if (contact == NULL) return; diff --git a/src/avahi-olpc-activity.c b/src/avahi-olpc-activity.c index 424da437..ea96235d 100644 --- a/src/avahi-olpc-activity.c +++ b/src/avahi-olpc-activity.c @@ -482,6 +482,7 @@ activity_resolved_cb (GaServiceResolver *resolver, salut_olpc_activity_update (SALUT_OLPC_ACTIVITY (self), room, activity_id, activity_name, activity_type, color, tags, FALSE); + tp_handle_unref (room_repo, room); avahi_free (activity_id); avahi_free (activity_type); avahi_free (activity_name); diff --git a/src/capability-set.c b/src/capability-set.c index 5f1fbe60..bd2a7bb0 100644 --- a/src/capability-set.c +++ b/src/capability-set.c @@ -514,6 +514,7 @@ gabble_capability_set_add (GabbleCapabilitySet *caps, handle = tp_handle_ensure (feature_handles, cap, NULL, NULL); tp_handle_set_add (caps->handles, handle); + tp_handle_unref (feature_handles, handle); } gboolean diff --git a/src/contact.c b/src/contact.c index 3dab6a2d..667246c3 100644 --- a/src/contact.c +++ b/src/contact.c @@ -293,6 +293,15 @@ salut_contact_dispose (GObject *object) priv->dispose_has_run = TRUE; #ifdef ENABLE_OLPC + if (self->olpc_cur_act_room != 0 && self->connection != NULL) + { + TpHandleRepoIface *room_repo = tp_base_connection_get_handles + ((TpBaseConnection *) self->connection, TP_HANDLE_TYPE_ROOM); + + tp_handle_unref (room_repo, self->olpc_cur_act_room); + self->olpc_cur_act_room = 0; + } + g_hash_table_foreach (priv->olpc_activities, (GHFunc) disconnect_activity_signal_foreach, self); g_hash_table_unref (priv->olpc_activities); @@ -302,6 +311,13 @@ salut_contact_dispose (GObject *object) /* release any references held by the object here */ + if (self->handle != 0 && self->connection != NULL) + { + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles + ((TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT); + tp_handle_unref (contact_repo, self->handle); + } + if (self->data_forms != NULL) { g_ptr_array_unref (self->data_forms); @@ -721,10 +737,18 @@ salut_contact_change_current_activity (SalutContact *self, if (self->olpc_cur_act != NULL || self->olpc_cur_act_room != 0) { g_free (self->olpc_cur_act); + if (self->olpc_cur_act_room != 0) + tp_handle_unref (room_repo, self->olpc_cur_act_room); self->olpc_cur_act = NULL; self->olpc_cur_act_room = 0; salut_contact_change (self, SALUT_CONTACT_OLPC_CURRENT_ACTIVITY); } + if (room_handle != 0) + { + /* tp_handle_ensure gave us a ref */ + tp_handle_unref (room_repo, room_handle); + } + } else { @@ -734,10 +758,17 @@ salut_contact_change_current_activity (SalutContact *self, self->olpc_cur_act_room != room_handle) { g_free (self->olpc_cur_act); + if (self->olpc_cur_act_room != 0) + tp_handle_unref (room_repo, self->olpc_cur_act_room); self->olpc_cur_act_room = room_handle; self->olpc_cur_act = g_strdup (current_activity_id); salut_contact_change (self, SALUT_CONTACT_OLPC_CURRENT_ACTIVITY); } + else + { + /* tp_handle_ensure gave us a ref */ + tp_handle_unref (room_repo, room_handle); + } } } diff --git a/src/muc-manager.c b/src/muc-manager.c index 5f3f24d4..182c1e92 100644 --- a/src/muc-manager.c +++ b/src/muc-manager.c @@ -1099,6 +1099,7 @@ invite_stanza_callback (WockyPorter *porter, if (connection == NULL) { + tp_handle_unref (room_repo, room_handle); /* FIXME some kinda error to the user maybe ? Ignore for now */ goto discard; } @@ -1119,6 +1120,7 @@ invite_stanza_callback (WockyPorter *porter, #endif salut_muc_channel_invited (chan, inviter_handle, reason, NULL); + tp_handle_unref (contact_repo, inviter_handle); return TRUE; diff --git a/src/olpc-activity.c b/src/olpc-activity.c index dd2f48ae..df3f9b58 100644 --- a/src/olpc-activity.c +++ b/src/olpc-activity.c @@ -194,6 +194,12 @@ salut_olpc_activity_dispose (GObject *object) priv->dispose_has_run = TRUE; + if (self->room != 0) + { + tp_handle_unref (room_repo, self->room); + self->room = 0; + } + if (priv->muc != NULL) { g_signal_handlers_disconnect_matched (priv->muc, G_SIGNAL_MATCH_DATA, @@ -437,7 +443,13 @@ salut_olpc_activity_update (SalutOlpcActivity *self, if (room != 0 && room != self->room) { + if (self->room != 0) + { + tp_handle_unref (room_repo, self->room); + } + self->room = room; + tp_handle_ref (room_repo, room); } if (id != NULL && tp_strdiff (id, self->id)) @@ -475,6 +475,12 @@ salut_self_dispose (GObject *object) if (priv->olpc_activities != NULL) g_hash_table_unref (priv->olpc_activities); + + if (self->olpc_cur_act_room != 0) + { + tp_handle_unref (priv->room_repo, self->olpc_cur_act_room); + self->olpc_cur_act_room = 0; + } #endif priv->room_repo = NULL; @@ -823,7 +829,12 @@ salut_self_set_olpc_current_activity (SalutSelf *self, g_free (self->olpc_cur_act); self->olpc_cur_act = g_strdup (id); + + if (self->olpc_cur_act_room != 0) + tp_handle_unref (self->priv->room_repo, self->olpc_cur_act_room); self->olpc_cur_act_room = room; + if (room != 0) + tp_handle_ref (self->priv->room_repo, room); if (!SALUT_SELF_GET_CLASS (self)->update_current_activity (self, room_name, &err)) diff --git a/src/tube-dbus.c b/src/tube-dbus.c index cfa504bf..026295f5 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -496,6 +496,17 @@ salut_tube_dbus_init (SalutTubeDBus *self) self->priv = priv; } +static void +unref_handle_foreach (gpointer key, + gpointer value, + gpointer user_data) +{ + TpHandle handle = GPOINTER_TO_UINT (key); + TpHandleRepoIface *contact_repo = (TpHandleRepoIface *) user_data; + + tp_handle_unref (contact_repo, handle); +} + static TpTubeChannelState get_tube_state (SalutTubeDBus *self) { @@ -563,6 +574,8 @@ salut_tube_dbus_dispose (GObject *object) { SalutTubeDBus *self = SALUT_TUBE_DBUS (object); SalutTubeDBusPrivate *priv = SALUT_TUBE_DBUS_GET_PRIVATE (self); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( + (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); if (priv->dispose_has_run) return; @@ -611,6 +624,8 @@ salut_tube_dbus_dispose (GObject *object) if (priv->dbus_names) { + g_hash_table_foreach (priv->dbus_names, unref_handle_foreach, + contact_repo); g_hash_table_unref (priv->dbus_names); } @@ -623,6 +638,8 @@ salut_tube_dbus_dispose (GObject *object) if (priv->reassembly_buffer) g_string_free (priv->reassembly_buffer, TRUE); + tp_handle_unref (contact_repo, priv->initiator); + priv->dispose_has_run = TRUE; if (G_OBJECT_CLASS (salut_tube_dbus_parent_class)->dispose) @@ -888,6 +905,7 @@ salut_tube_dbus_constructor (GType type, SalutTubeDBusPrivate *priv; TpDBusDaemon *bus; TpBaseConnection *base_conn; + TpHandleRepoIface *contact_repo; TpHandleRepoIface *handles_repo; TpSocketAccessControl access_control; @@ -903,6 +921,9 @@ salut_tube_dbus_constructor (GType type, /* Ref the initiator handle */ g_assert (priv->conn != NULL); g_assert (priv->initiator != 0); + contact_repo = tp_base_connection_get_handles (base_conn, + TP_HANDLE_TYPE_CONTACT); + tp_handle_ref (contact_repo, priv->initiator); bus = tp_base_connection_get_dbus_daemon (base_conn); tp_dbus_daemon_register_object (bus, priv->object_path, obj); @@ -1585,6 +1606,7 @@ salut_tube_dbus_add_name (SalutTubeDBus *self, g_hash_table_insert (priv->dbus_names, GUINT_TO_POINTER (handle), g_strdup (name)); + tp_handle_ref (contact_repo, handle); /* Fire DBusNamesChanged (new API) */ added = g_hash_table_new (g_direct_hash, g_direct_equal); @@ -1606,6 +1628,8 @@ salut_tube_dbus_remove_name (SalutTubeDBus *self, TpHandle handle) { SalutTubeDBusPrivate *priv = SALUT_TUBE_DBUS_GET_PRIVATE (self); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( + (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); const gchar *name; GHashTable *added; GArray *removed; @@ -1629,6 +1653,7 @@ salut_tube_dbus_remove_name (SalutTubeDBus *self, g_hash_table_unref (added); g_array_unref (removed); + tp_handle_unref (contact_repo, handle); return TRUE; } diff --git a/src/tube-stream.c b/src/tube-stream.c index acb3a8e9..e538cc16 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -1010,6 +1010,8 @@ salut_tube_stream_dispose (GObject *object) { SalutTubeStream *self = SALUT_TUBE_STREAM (object); SalutTubeStreamPrivate *priv = SALUT_TUBE_STREAM_GET_PRIVATE (self); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( + (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); if (priv->dispose_has_run) return; @@ -1053,6 +1055,8 @@ salut_tube_stream_dispose (GObject *object) priv->transport_to_id = NULL; } + tp_handle_unref (contact_repo, priv->initiator); + if (priv->local_listener != NULL) { g_object_unref (priv->local_listener); @@ -1358,6 +1362,7 @@ salut_tube_stream_constructor (GType type, { GObject *obj; SalutTubeStreamPrivate *priv; + TpHandleRepoIface *contact_repo; TpDBusDaemon *bus; TpBaseConnection *base_conn; @@ -1369,6 +1374,9 @@ salut_tube_stream_constructor (GType type, /* Ref the initiator handle */ base_conn = TP_BASE_CONNECTION (priv->conn); g_assert (priv->initiator != 0); + contact_repo = tp_base_connection_get_handles (base_conn, + TP_HANDLE_TYPE_CONTACT); + tp_handle_ref (contact_repo, priv->initiator); if (priv->initiator == priv->self_handle) { @@ -2007,6 +2015,7 @@ salut_tube_stream_add_bytestream (SalutTubeIface *tube, fire_new_remote_connection (self, transport, contact); + tp_handle_unref (contact_repo, contact); g_free (peer_id); } else diff --git a/src/tubes-channel.c b/src/tubes-channel.c index 289eb3b3..988c78eb 100644 --- a/src/tubes-channel.c +++ b/src/tubes-channel.c @@ -196,6 +196,7 @@ salut_tubes_channel_constructor (GType type, SalutTubesChannelPrivate *priv; TpDBusDaemon *bus; TpBaseConnection *base_conn; + TpHandleRepoIface *handle_repo; obj = G_OBJECT_CLASS (salut_tubes_channel_parent_class)-> constructor (type, n_props, props); @@ -204,6 +205,10 @@ salut_tubes_channel_constructor (GType type, priv = SALUT_TUBES_CHANNEL_GET_PRIVATE (self); base_conn = TP_BASE_CONNECTION (priv->conn); + handle_repo = tp_base_connection_get_handles ( + base_conn, priv->handle_type); + + tp_handle_ref (handle_repo, priv->handle); switch (priv->handle_type) { @@ -693,7 +698,12 @@ salut_tubes_channel_muc_message_received (SalutTubesChannel *self, break; case TP_TUBE_TYPE_STREAM: { + if (initiator_handle != 0) + /* ignore it */ + tp_handle_unref (contact_repo, initiator_handle); + initiator_handle = contact; + tp_handle_ref (contact_repo, initiator_handle); } break; default: @@ -707,6 +717,7 @@ salut_tubes_channel_muc_message_received (SalutTubesChannel *self, g_ptr_array_add (result, tube); /* the tube has reffed its initiator, no need to keep a ref */ + tp_handle_unref (contact_repo, initiator_handle); g_hash_table_unref (parameters); } } @@ -2309,6 +2320,8 @@ salut_tubes_channel_dispose (GObject *object) { SalutTubesChannel *self = SALUT_TUBES_CHANNEL (object); SalutTubesChannelPrivate *priv = SALUT_TUBES_CHANNEL_GET_PRIVATE (self); + TpHandleRepoIface *handle_repo = tp_base_connection_get_handles ( + (TpBaseConnection *) priv->conn, priv->handle_type); if (priv->dispose_has_run) return; @@ -2330,6 +2343,8 @@ salut_tubes_channel_dispose (GObject *object) priv->dispose_has_run = TRUE; + tp_handle_unref (handle_repo, priv->handle); + if (self->muc != NULL) tp_external_group_mixin_finalize (object); |