[PATCH] PolicyKit refcounting

Ludwig Nussel ludwig.nussel at suse.de
Wed May 24 02:18:32 PDT 2006


Hi,

The reference was added using g_object_weak_ref, so use
g_object_weak_unref to remove it otherwise the objects gets
destroyed too early causing a crash later.

Index: polkitd/polkit-manager.c
===================================================================
RCS file: /cvs/hal/PolicyKit/polkitd/polkit-manager.c,v
retrieving revision 1.2
diff -u -r1.2 polkit-manager.c
--- polkitd/polkit-manager.c	22 Apr 2006 23:27:14 -0000	1.2
+++ polkitd/polkit-manager.c	24 May 2006 09:07:42 -0000
@@ -63,6 +63,8 @@
 	pid_t  pid;
 } CallerInfo;
 
+static void session_finalized (gpointer  data, GObject  *where_the_object_was);
+
 static void 
 caller_info_delete (gpointer data)
 {
@@ -173,7 +175,7 @@
 			polkit_session_initiator_disconnected (session);
 
 			/* end the session */
-			g_object_unref (session);
+			g_object_weak_unref (G_OBJECT(session), session_finalized, manager);
 
 			g_hash_table_remove (manager->priv->connection_name_to_session_object, old_service_name);
 		}

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/



More information about the hal mailing list