diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-17 17:37:15 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-17 17:38:08 +0300 |
commit | f827811a42b9aa9e3fe6969f69bb9362814c250e (patch) | |
tree | 60e5b6985c9ba2dce8c2e26906382c6dbfd6220e /source/blender/editors/scene/scene_edit.c | |
parent | 495aff71ca81c77d2384dd13f5d24039ab2f9458 (diff) |
Fix T65886: Crash when deleting a scene when "New Main Window" is open.
When we delete a scene, we need to update to new scene pointer all main
widows that might be using it, not only the active one from the context...
Diffstat (limited to 'source/blender/editors/scene/scene_edit.c')
-rw-r--r-- | source/blender/editors/scene/scene_edit.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c index 8834d243d4a..b04719d7782 100644 --- a/source/blender/editors/scene/scene_edit.c +++ b/source/blender/editors/scene/scene_edit.c @@ -86,7 +86,7 @@ Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod me * \note Only call outside of area/region loops * \return true if successful */ -bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene) +bool ED_scene_delete(bContext *C, Main *bmain, Scene *scene) { Scene *scene_new; @@ -104,7 +104,14 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene) return false; } - WM_window_set_active_scene(bmain, C, win, scene_new); + for (wmWindow *win = wm->windows.first; win; win = win->next) { + if (win->parent != NULL) { /* We only care about main windows here... */ + continue; + } + if (win->scene == scene) { + WM_window_set_active_scene(bmain, C, win, scene_new); + } + } BKE_id_delete(bmain, scene); @@ -244,7 +251,7 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - if (ED_scene_delete(C, CTX_data_main(C), CTX_wm_window(C), scene) == false) { + if (ED_scene_delete(C, CTX_data_main(C), scene) == false) { return OPERATOR_CANCELLED; } |