diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-07 23:40:28 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-08 15:37:12 +0300 |
commit | a566b71333cf9352bc676bbf8df6922d99eeaa81 (patch) | |
tree | 18147b5c72739943f52a363b067b752200c32a90 /source | |
parent | f5ad622009faf9f4ab382f5b51a811d2b2f505dd (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.
Diffstat (limited to 'source')
-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); |