From 95b9d6d9c2063426a0051363a7de0214b8e89cc1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 2 Jun 2015 18:57:52 +1000 Subject: Fix operator exec /w popups that close the window Related to T44688, note supporting this case isn't so nice, but seems it can be made to work. --- source/blender/editors/interface/interface_regions.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/interface') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 99e4af62567..9835f0885b6 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -3051,11 +3051,14 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int void UI_popup_block_close(bContext *C, uiBlock *block) { - if (block->handle) { - wmWindow *win = CTX_wm_window(C); + wmWindow *win = CTX_wm_window(C); + + /* check window before 'block->handle' incase the + * popup execution closed the window and freed the block. see T44688. */ - /* if loading new .blend while popup is open, window will be NULL */ - if (win) { + /* if loading new .blend while popup is open, window will be NULL */ + if (win) { + if (block->handle) { UI_popup_handlers_remove(&win->modalhandlers, block->handle); ui_popup_block_free(C, block->handle); } -- cgit v1.2.3