Fix T55581: kill running (render) jobs when deleting a scene
authorPhilipp Oeser <info@graphics-engineer.com>
Fri, 22 Jun 2018 11:44:12 +0000 (13:44 +0200)
committerPhilipp Oeser <info@graphics-engineer.com>
Fri, 6 Jul 2018 09:58:13 +0000 (11:58 +0200)
also fixed passing WM_JOB_TYPE_ANY to WM_jobs_kill_type()

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D3498

source/blender/editors/screen/screen_edit.c
source/blender/windowmanager/intern/wm_jobs.c

index 82552c35786bf643d00ef3105e702b718e486e98..131b509df5a2c509a72b944173d1adbb8ec8f3c7 100644 (file)
@@ -1447,6 +1447,10 @@ bool ED_screen_delete_scene(bContext *C, Scene *scene)
        Main *bmain = CTX_data_main(C);
        Scene *newscene;
 
+       // kill running jobs
+       wmWindowManager *wm = CTX_wm_manager(C);
+       WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_ANY);
+
        if (scene->id.prev)
                newscene = scene->id.prev;
        else if (scene->id.next)
index 3a4195ae1aefa5e82b8f1d738db1d72a656f30b1..dd9e7edf4135a3c0fb922378cf290abf79af1d67 100644 (file)
@@ -500,7 +500,7 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
                next_job = wm_job->next;
 
                if (!owner || wm_job->owner == owner)
-                       if (wm_job->job_type == job_type)
+                       if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type)
                                wm_jobs_kill_job(wm, wm_job);
        }
 }