From 8a1a0ba450fb54e0ba8272840e817716d61dc73c Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 13 Mar 2003 14:26:04 +0000 Subject: use a weak ref instead of connecting to backend's "destroy" signal. 2003-03-13 Rodrigo Moya * pcs/query-backend.c (query_backend_new): use a weak ref instead of connecting to backend's "destroy" signal. (backend_destroyed_cb, query_destroyed_cb): changed to be weak reference callbacks. svn path=/trunk/; revision=20271 --- calendar/ChangeLog | 7 +++++++ calendar/pcs/query-backend.c | 14 +++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8009f179a8..ea84ebe756 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2003-03-13 Rodrigo Moya + + * pcs/query-backend.c (query_backend_new): use a weak ref instead + of connecting to backend's "destroy" signal. + (backend_destroyed_cb, query_destroyed_cb): changed to be weak + reference callbacks. + 2003-03-12 Rodrigo Moya * gui/dialogs/save-comp.c (save_component_dialog): don't use diff --git a/calendar/pcs/query-backend.c b/calendar/pcs/query-backend.c index 8bace1023d..7d6cca041a 100644 --- a/calendar/pcs/query-backend.c +++ b/calendar/pcs/query-backend.c @@ -148,12 +148,10 @@ query_backend_get_type (void) } static void -backend_destroyed_cb (GObject *object, gpointer user_data) +backend_destroyed_cb (gpointer user_data, GObject *where_backend_was) { - CalBackend *backend = (CalBackend *) object; QueryBackend *qb = (QueryBackend *) user_data; - g_return_if_fail (IS_CAL_BACKEND (backend)); g_return_if_fail (IS_QUERY_BACKEND (qb)); g_object_unref (qb); @@ -215,9 +213,9 @@ object_removed_cb (CalBackend *backend, const char *uid, gpointer user_data) } static void -query_destroyed_cb (GObject *object, gpointer user_data) +query_destroyed_cb (gpointer user_data, GObject *where_the_object_was) { - Query *query = (Query *) object; + Query *query = (Query *) where_the_object_was; QueryBackend *qb = (QueryBackend *) user_data; g_return_if_fail (IS_QUERY (query)); @@ -276,8 +274,7 @@ query_backend_new (Query *query, CalBackend *backend) g_list_foreach (uidlist, foreach_uid_cb, qb); cal_obj_uid_list_free (uidlist); - g_signal_connect (G_OBJECT (backend), "destroy", - G_CALLBACK (backend_destroyed_cb), qb); + g_object_weak_ref (G_OBJECT (backend), backend_destroyed_cb, qb); g_signal_connect (G_OBJECT (backend), "obj_updated", G_CALLBACK (object_updated_cb), qb); g_signal_connect (G_OBJECT (backend), "obj_removed", @@ -287,8 +284,7 @@ query_backend_new (Query *query, CalBackend *backend) } qb->priv->queries = g_list_append (qb->priv->queries, query); - g_signal_connect (G_OBJECT (query), "destroy", - G_CALLBACK (query_destroyed_cb), qb); + g_object_weak_ref (G_OBJECT (query), query_destroyed_cb, qb); return qb; } -- cgit