diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-07 23:40:28 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2019-09-12 04:13:03 +0300 |
commit | c1cc9f94ed58ba786d574cd08771d5cfae4a7d2f (patch) | |
tree | 65ce8e7f2e5285b52ae21b4941aa3f5b4e393a98 | |
parent | afcbcc0e294bfe09ba6bdbad202b03d04dd94961 (diff) |
Fix crash closing stacked file browser window
Caused by ab823176d31dc1.
Steps to reproduce were:
* Open Preferences
* Open file browser through Lights -> Install (doesn't matter which)
* Close browser through the window controlls
The window was freed earlier, but still referenced by new handler
context storage.
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ff22956e723..21c6c2ae60b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2384,7 +2384,13 @@ static int wm_handler_fileselect_do(bContext *C, /* remlink now, for load file case before removing*/ BLI_remlink(handlers, handler); - if (val != EVT_FILESELECT_EXTERNAL_CANCEL) { + if (val == EVT_FILESELECT_EXTERNAL_CANCEL) { + /* The window might have been freed already. */ + if (BLI_findindex(&wm->windows, handler->context.win) == -1) { + handler->context.win = NULL; + } + } + else { for (wmWindow *win = wm->windows.first; win; win = win->next) { if (WM_window_is_temp_screen(win)) { bScreen *screen = WM_window_get_active_screen(win); |