From 1979bd6902df68528a9442365da03ff881642def Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 2 May 2023 12:47:19 -0300 Subject: [PATCH] WM: don't skip AutoSave if modal operator is 'fileselect' AutoSave is skipped if we have a file select handle open. But a user could inadvertently minimize the window from that handle, causing AutoSave to no longer work. So skip this case of skipping AutoSave. --- That's a shot in the dark. Commit cb8f7fd385 implemented the following behavior for AutoSave: - Autosave is postponed by 10 seconds when a modal operator is running, e.g. transform or file browsing. But it's not clear why or which state is not safe for AutoSave. Those conditions that skip AutoSave could be causing inconveniences that are hard to track down. It is possible for example that it is the cause commented on https://projects.blender.org/blender/blender/issues/107421#issuecomment-931721 That's why this PR proposes to be a little less strict for cases of skipping AutoSave. --- source/blender/windowmanager/intern/wm_files.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 5a7e8bc65f3..87a7fdb099c 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -2083,6 +2083,11 @@ void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer * /*wt*/) LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { if (handler_base->type == WM_HANDLER_TYPE_OP) { wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; + if (handler->is_fileselect) { + /* Skip the file selection handle because, as a non-blocking operator, the user can keep + * its window open longer than is convenient for Auto-Save. */ + continue; + } if (handler->op) { wm_autosave_timer_begin_ex(wm, 0.01); return; @@ -3039,7 +3044,8 @@ static int wm_recover_last_session_invoke(bContext *C, wmOperator *op, const wmE wm_open_init_use_scripts(op, false); if (wm_operator_close_file_dialog_if_needed( - C, op, wm_recover_last_session_after_dialog_callback)) { + C, op, wm_recover_last_session_after_dialog_callback)) + { return OPERATOR_INTERFACE; } return wm_recover_last_session_exec(C, op); -- 2.30.2