From 70ab1c2aaba17f4b675089c2ed5e2677a8ed177b Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 26 Oct 2011 14:27:32 -0400 Subject: [PATCH] Don't leak job objects In particular, since each job has a GCancellable, this meant that we were leaking an eventfd per job. Signed-off-by: David Zeuthen --- src/udisksdaemon.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/udisksdaemon.c b/src/udisksdaemon.c index 2313ff2..d1cfb5a 100644 --- a/src/udisksdaemon.c +++ b/src/udisksdaemon.c @@ -475,6 +475,9 @@ on_job_completed (UDisksJob *job, g_dbus_object_get_object_path (G_DBUS_OBJECT (object))); g_object_unref (object); + /* free the allocated job object */ + g_object_unref (job); + /* returns the reference we took when connecting to the * UDisksJob::completed signal in udisks_daemon_launch_{spawned,threaded}_job() * below @@ -501,7 +504,8 @@ static guint job_id = 0; * been cancelled. * * The returned object will be exported on the bus until the - * #UDisksJob::completed signal is emitted on the object. + * #UDisksJob::completed signal is emitted on the object. It is not + * valid to use the returned object after this signal fires. * * Returns: A #UDisksSimpleJob object. Do not free, the object * belongs to @manager. @@ -553,7 +557,8 @@ udisks_daemon_launch_simple_job (UDisksDaemon *daemon, * they have been cancelled. * * The returned object will be exported on the bus until the - * #UDisksJob::completed signal is emitted on the object. + * #UDisksJob::completed signal is emitted on the object. It is not + * valid to use the returned object after this signal fires. * * Returns: A #UDisksThreadedJob object. Do not free, the object * belongs to @manager. @@ -611,7 +616,8 @@ udisks_daemon_launch_threaded_job (UDisksDaemon *daemon, * signals to get notified when the job is done. * * The returned object will be exported on the bus until the - * #UDisksJob::completed signal is emitted on the object. + * #UDisksJob::completed signal is emitted on the object. It is not + * valid to use the returned object after this signal fires. * * Returns: A #UDisksSpawnedJob object. Do not free, the object * belongs to @manager. -- 2.7.4