From 95ee06d068a6526ef773e2cb40420c744cf39e1e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 16 Jun 2020 23:37:13 +0200 Subject: Fix T77825: autosave missed too often while sculpting Previously if a modal operator is active, which might leave Blender in a state where it's not safe to autosave, it would try again in 10s. Now try again in 10ms so it's much less likely to be missed, since overhead of such a timer is negligble anyway. Also remove the debug print that was added to investigate a bug at some point. --- source/blender/windowmanager/intern/wm_files.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_files.c') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d08636e826c..d5a240a358e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1611,16 +1611,14 @@ void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt)) WM_event_remove_timer(wm, NULL, wm->autosavetimer); - /* if a modal operator is running, don't autosave, but try again in 10 seconds */ + /* If a modal operator is running, don't autosave because we might not be in + * a valid state to save. But try again in 10ms. */ LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { if (handler_base->type == WM_HANDLER_TYPE_OP) { wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; if (handler->op) { - wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0); - if (G.debug) { - printf("Skipping auto-save, modal operator running, retrying in ten seconds...\n"); - } + wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 0.01); return; } } -- cgit v1.2.3