diff --git a/daemon/gvfschannel.c b/daemon/gvfschannel.c index c0c26da..fa490f6 100644 --- a/daemon/gvfschannel.c +++ b/daemon/gvfschannel.c @@ -644,6 +644,7 @@ send_reply_cb (GObject *source_object, } g_object_unref (job); + g_object_unref (channel); } /* Might be called on an i/o thread */ @@ -667,7 +668,7 @@ g_vfs_channel_send_reply (GVfsChannel *channel, channel->priv->reply_buffer, G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SIZE, 0, NULL, - send_reply_cb, channel); + send_reply_cb, g_object_ref (channel)); } else { @@ -676,7 +677,7 @@ g_vfs_channel_send_reply (GVfsChannel *channel, channel->priv->output_data, channel->priv->output_data_size, 0, NULL, - send_reply_cb, channel); + send_reply_cb, g_object_ref (channel)); } } diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c index 0946f41..e35d7f7 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c @@ -209,6 +209,7 @@ job_handler_callback (gpointer data, GVfsJob *job = G_VFS_JOB (data); g_vfs_job_run (job); + g_object_unref (job); } static void @@ -648,7 +649,8 @@ g_vfs_daemon_queue_job (GVfsDaemon *daemon, if (!g_vfs_job_try (job)) { /* Couldn't finish / run async, queue worker thread */ - g_thread_pool_push (daemon->thread_pool, job, NULL); /* TODO: Check error */ + if (!g_thread_pool_push (daemon->thread_pool, g_object_ref (job), NULL)) /* TODO: Check error */ + g_object_unref (job); } } @@ -1169,7 +1171,8 @@ void g_vfs_daemon_run_job_in_thread (GVfsDaemon *daemon, GVfsJob *job) { - g_thread_pool_push (daemon->thread_pool, job, NULL); /* TODO: Check error */ + if (!g_thread_pool_push (daemon->thread_pool, g_object_ref (job), NULL)) /* TODO: Check error */ + g_object_unref (job); } void