[Bf-blender-cvs] [95ee06d068a] master: Fix T77825: autosave missed too often while sculpting

Brecht Van Lommel noreply at git.blender.org
Tue Jun 30 18:12:15 CEST 2020


Commit: 95ee06d068a6526ef773e2cb40420c744cf39e1e
Author: Brecht Van Lommel
Date:   Tue Jun 16 23:37:13 2020 +0200
Branches: master
https://developer.blender.org/rB95ee06d068a6526ef773e2cb40420c744cf39e1e

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.

===================================================================

M	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;
         }
       }



More information about the Bf-blender-cvs mailing list