diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-15 13:25:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-15 13:36:50 +0300 |
commit | e375685e06d0b4c52a0aacb8982684e45b490d5c (patch) | |
tree | 99f832891b05d72af98b4fe68ef0b10187da8332 /source/blender/windowmanager/intern | |
parent | 01029c68d293593ccf5019793a5b577b3b522338 (diff) |
Cleanup: pass main instead of context w/ ED_editors_exit/flush_edits
Useful for calling from lower level code.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 11 |
2 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index beb963a2af3..379bd56a9c2 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -184,7 +184,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) * (see T47632), so for now just handling this specific case here. */ CTX_wm_menu_set(C, NULL); - ED_editors_exit(C); + ED_editors_exit(G_MAIN); } static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm, wmWindow *oldwin, wmWindow *win) @@ -1296,7 +1296,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo /* don't forget not to return without! */ WM_cursor_wait(1); - ED_editors_flush_edits(C, false); + ED_editors_flush_edits(bmain, false); fileflags |= G_FILE_HISTORY; /* write file history */ @@ -1428,12 +1428,13 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w } else { /* save as regular blend file */ + Main *bmain = CTX_data_main(C); int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); - ED_editors_flush_edits(C, false); + ED_editors_flush_edits(bmain, false); /* Error reporting into console */ - BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); + BLO_write_file(bmain, filepath, fileflags, NULL, NULL); } /* do timer after file write, just in case file write takes a long time */ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0); @@ -1554,7 +1555,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) printf("Writing homefile: '%s' ", filepath); - ED_editors_flush_edits(C, false); + ED_editors_flush_edits(bmain, false); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index e4ae9495c61..e3587c2c965 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -440,15 +440,16 @@ void WM_exit_ext(bContext *C, const bool do_python) 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 */ + Main *bmain = CTX_data_main(C); char filename[FILE_MAX]; bool has_edited; int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE); - has_edited = ED_editors_flush_edits(C, false); + has_edited = ED_editors_flush_edits(bmain, false); - if ((has_edited && BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL)) || + if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) || (undo_memfile && BLO_memfile_write_file(undo_memfile, filename))) { printf("Saved session recovery to '%s'\n", filename); @@ -480,8 +481,10 @@ void WM_exit_ext(bContext *C, const bool do_python) WM_uilisttype_free(); /* all non-screen and non-space stuff editors did, like editmode */ - if (C) - ED_editors_exit(C); + if (C) { + Main *bmain = CTX_data_main(C); + ED_editors_exit(bmain); + } ED_undosys_type_free(); |