[Bf-blender-cvs] [96dd194] master: Fix crash calling wm.open_mainfile from menu with --debug-memory enabled

Julian Eisel noreply at git.blender.org
Thu Sep 1 17:04:51 CEST 2016


Commit: 96dd1943afc4f08e4befb44602a3c621a446c678
Author: Julian Eisel
Date:   Thu Sep 1 16:55:01 2016 +0200
Branches: master
https://developer.blender.org/rB96dd1943afc4f08e4befb44602a3c621a446c678

Fix crash calling wm.open_mainfile from menu with --debug-memory enabled

Didn't do any bisecting, but guess it's caused rBb54e95a5c8dcb7 (2.74 is fine, 2.75 isn't).
I think this fix makes some other hacks redundant but need to check details (will do when we're back to bcon1 to avoid regressions).

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

M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 8918b6b..0c13722 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1369,9 +1369,6 @@ typedef struct wmOpPopUp {
 /* Only invoked by OK button in popups created with wm_block_dialog_create() */
 static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
 {
-	wmWindowManager *wm = CTX_wm_manager(C);
-	wmWindow *win = CTX_wm_window(C);
-
 	wmOpPopUp *data = arg1;
 	uiBlock *block = arg2;
 
@@ -1388,8 +1385,18 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
 	/* in this case, wm_operator_ui_popup_cancel wont run */
 	MEM_freeN(data);
 
+	/* get context data *after* WM_operator_call_ex which might have closed the current file and changed context */
+	wmWindowManager *wm = CTX_wm_manager(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. */
+	 * popup execution closed the window and freed the block. see T44688.
+	 */
+	/* Post 2.78 TODO: Check if this fix and others related to T44688 are still
+	 * needed or can be improved now that requesting context data has been corrected
+	 * (see above). We're close to release so not a good time for experiments.
+	 * -- Julian
+	 */
 	if (BLI_findindex(&wm->windows, win) != -1) {
 		UI_popup_block_close(C, win, block);
 	}




More information about the Bf-blender-cvs mailing list