In the discussion that followed, I was just worried that his modifications introduced a potential use-after-free crash, because the JobData created by ck_session_leader_collect_parameters isn’t holding a reference to its leader. If there is no way for a CkSessionLeader to be freed with entries remaining in its pending_jobs queue (previously this was prevented by the missing unref in create_session_for_sender), then that isn’t a concern and this can be closed. Otherwise, perhaps this presentation makes it clearer why the extra ref and unref are okay?
(In reply to comment #14)
> Please either apply the patch, or find some other way to stop the leak.
William already applied a modified version of my patch for 0.4.2. The leak should already be gone. cgit.freedeskto p.org/ConsoleKi t/commit/ ?id=7b9212fa6af f55420c58f2cacd 0a941762920337
http://
In the discussion that followed, I was just worried that his modifications introduced a potential use-after-free crash, because the JobData created by ck_session_ leader_ collect_ parameters isn’t holding a reference to its leader. If there is no way for a CkSessionLeader to be freed with entries remaining in its pending_jobs queue (previously this was prevented by the missing unref in create_ session_ for_sender) , then that isn’t a concern and this can be closed. Otherwise, perhaps this presentation makes it clearer why the extra ref and unref are okay?
--- a/src/ck- session- leader. c session- leader. c
+++ b/src/ck-
@@ -409,6 +409,7 @@ job_completed (CkJob *job,
static void
job_data_free (JobData *data)
{
+ g_object_unref (data->leader);
g_free (data);
}
@@ -428,7 +429,7 @@ ck_session_ leader_ collect_ parameters (CkSessionLeader *session_leader,
ret = FALSE;
data = g_new0 (JobData, 1);
data- >done_cb = done_cb;
data- >user_data = user_data;
data- >context = context;
- data->leader = session_leader;
+ data->leader = g_object_ref (session_leader);