core: simplify - don't add jobs to dbus queue if we immediately remove them (#7251)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Tue, 7 Nov 2017 16:14:15 +0000 (16:14 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 7 Nov 2017 16:14:15 +0000 (19:14 +0300)
job_finish_and_invalidate() calls job_free() to destroy jobs (and remove
them from the dbus queue).  So we don't need to add them to the dbus queue
first.

We only want to add jobs to the dbus queue if they're a restart job, which
we're transmogrifying into a start job and putting back into the system.

src/core/job.c

index fb57f19..d441453 100644 (file)
@@ -868,14 +868,13 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
         if (!already)
                 job_emit_status_message(u, t, result);
 
-        job_add_to_dbus_queue(j);
-
         /* Patch restart jobs so that they become normal start jobs */
         if (result == JOB_DONE && t == JOB_RESTART) {
 
                 job_change_type(j, JOB_START);
                 job_set_state(j, JOB_WAITING);
 
+                job_add_to_dbus_queue(j);
                 job_add_to_run_queue(j);
                 job_add_to_gc_queue(j);