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.
This commit is contained in:
Campbell Barton 2015-06-02 18:57:52 +10:00
parent 5f5e05b3eb
commit 95b9d6d9c2
Notes: blender-bot 2023-02-14 09:08:31 +01:00
Referenced by issue #44688, To set stereo 3d mode to Time Sequential may crash Blender
1 changed files with 7 additions and 4 deletions

View File

@ -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);
/* if loading new .blend while popup is open, window will be NULL */
if (win) {
/* 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 (block->handle) {
UI_popup_handlers_remove(&win->modalhandlers, block->handle);
ui_popup_block_free(C, block->handle);
}