[Bf-blender-cvs] [95b9d6d] master: Fix operator exec /w popups that close the window

Campbell Barton noreply at git.blender.org
Tue Jun 2 11:03:05 CEST 2015


Commit: 95b9d6d9c2063426a0051363a7de0214b8e89cc1
Author: Campbell Barton
Date:   Tue Jun 2 18:57:52 2015 +1000
Branches: master
https://developer.blender.org/rB95b9d6d9c2063426a0051363a7de0214b8e89cc1

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.

===================================================================

M	source/blender/editors/interface/interface_regions.c

===================================================================

diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 99e4af6..9835f08 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);
 		}




More information about the Bf-blender-cvs mailing list