Fix crash closing stacked file browser window

Caused by ab823176d3.
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.
This commit is contained in:
Julian Eisel
2019-09-07 22:40:28 +02:00
parent f5ad622009
commit a566b71333

View File

@@ -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);