diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 3333c485aae..9e0408097d9 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -74,11 +74,6 @@ void wm_operator_register(wmWindowManager *wm, wmOperator *op) { int tot; - if(op->ptr) { - // MEM_freeN(op->ptr); - // op->ptr= NULL; - } - BLI_addtail(&wm->operators, op); tot= BLI_countlist(&wm->operators); @@ -130,7 +125,7 @@ void wm_add_default(bContext *C) } -/* context is allowed to be NULL, do net free wm itself (library.c) */ +/* context is allowed to be NULL, do not free wm itself (library.c) */ void wm_close_and_free(bContext *C, wmWindowManager *wm) { wmWindow *win; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c74497fa10b..1f5ed78ba58 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -310,9 +310,11 @@ int WM_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event) if((retval & OPERATOR_FINISHED) && (ot->flag & OPTYPE_REGISTER)) { wm_operator_register(C->wm, op); + handler->op= NULL; } else if(!(retval & OPERATOR_RUNNING_MODAL)) { wm_operator_free(op); + handler->op= NULL; } } @@ -400,6 +402,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand handler->op= NULL; } + /* remove modal handler, operator itself should have been cancelled and freed */ if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { BLI_remlink(handlers, handler); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index b8a60710063..75306dc75d8 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -872,7 +872,7 @@ int WM_write_homefile(bContext *C, wmOperator *op) write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN); BLO_write_file(C, tstr, write_flags, &err); - return 1; + return OPERATOR_FINISHED; } void WM_write_autosave(bContext *C)