diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_init_exit.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 2743216ee07..b9ac05e0c57 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -55,6 +55,7 @@ #include "BLI_utildefines.h" #include "BLO_writefile.h" +#include "BLO_undofile.h" #include "BKE_blender.h" #include "BKE_blender_undo.h" @@ -149,11 +150,6 @@ static void wm_free_reports(bContext *C) BKE_reports_clear(reports); } -static void wm_undo_kill_callback(bContext *C) -{ - WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); -} - bool wm_start_with_console = false; /* used in creator.c */ /* only called once, for startup */ @@ -172,7 +168,7 @@ void WM_init(bContext *C, int argc, const char **argv) WM_menutype_init(); WM_uilisttype_init(); - BKE_undo_callback_wm_kill_jobs_set(wm_undo_kill_callback); + ED_undosys_type_init(); BKE_library_callback_free_window_manager_set(wm_close_and_free); /* library.c */ BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference); /* library.c */ @@ -478,7 +474,8 @@ void WM_exit_ext(bContext *C, const bool do_python) wmWindow *win; if (!G.background) { - if ((U.uiflag2 & USER_KEEP_SESSION) || BKE_undo_is_valid(NULL)) { + struct MemFile *undo_memfile = wm->undo_stack ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : NULL; + if ((U.uiflag2 & USER_KEEP_SESSION) || (undo_memfile != NULL)) { /* save the undo state as quit.blend */ char filename[FILE_MAX]; bool has_edited; @@ -489,7 +486,7 @@ void WM_exit_ext(bContext *C, const bool do_python) has_edited = ED_editors_flush_edits(C, false); if ((has_edited && BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL)) || - BKE_undo_save_file(filename)) + (undo_memfile && BLO_memfile_write_file(undo_memfile, filename))) { printf("Saved session recovery to '%s'\n", filename); } @@ -512,11 +509,13 @@ void WM_exit_ext(bContext *C, const bool do_python) wm_dropbox_free(); WM_menutype_free(); WM_uilisttype_free(); - + /* all non-screen and non-space stuff editors did, like editmode */ if (C) ED_editors_exit(C); + ED_undosys_type_free(); + // XXX // BIF_GlobalReebFree(); // BIF_freeRetarget(); @@ -594,8 +593,6 @@ void WM_exit_ext(bContext *C, const bool do_python) GPU_exit(); } - BKE_undo_reset(); - ED_file_exit(); /* for fsmenu */ UI_exit(); |