diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-18 16:35:51 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-09-18 22:39:53 +0300 |
commit | 32e6d5cd6f407dac19cc73f9623f5166959b4273 (patch) | |
tree | e8e3fb03e1e012b3a4e22f8c02e6b1dc3f196e56 /source/blender/editors/interface/interface_icons.c | |
parent | a1a58c8d0a95005d84484b2db90ce2cbabc73316 (diff) |
StudioLight: Fix crash when closing blender
The studiolight was being free after the window manager and was attempting
to stop the job again.
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 8816d6acec8..50a5c711b2e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1051,6 +1051,10 @@ static void ui_studiolight_free_function(StudioLight *sl, void *data) { wmWindowManager *wm = data; + /* Happens if job was canceled or already finished. */ + if (wm == NULL) + return; + // get icons_id, get icons and kill wm jobs if (sl->icon_id_radiance) { ui_studiolight_kill_icon_preview_job(wm, sl->icon_id_radiance); @@ -1066,6 +1070,14 @@ static void ui_studiolight_free_function(StudioLight *sl, void *data) } } +static void ui_studiolight_icon_job_end(void *customdata) +{ + Icon **tmp = (Icon **)customdata; + Icon *icon = *tmp; + StudioLight *sl = icon->obj; + BKE_studiolight_set_free_function(sl, &ui_studiolight_free_function, NULL); +} + void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big) { Icon *icon = BKE_icon_get(icon_id); @@ -1113,7 +1125,7 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi *tmp = icon; WM_jobs_customdata_set(wm_job, tmp, MEM_freeN); WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW); - WM_jobs_callbacks(wm_job, ui_studiolight_icon_job_exec, NULL, NULL, NULL); + WM_jobs_callbacks(wm_job, ui_studiolight_icon_job_exec, NULL, NULL, ui_studiolight_icon_job_end); WM_jobs_start(CTX_wm_manager(C), wm_job); } } |