[Bf-blender-cvs] [6cf148227b2] master: WM: disable redraw timer in background mode

Campbell Barton noreply at git.blender.org
Tue Apr 26 11:21:35 CEST 2022


Commit: 6cf148227b220dd5087241ad01b6d2d6fe9afb80
Author: Campbell Barton
Date:   Tue Apr 26 19:18:51 2022 +1000
Branches: master
https://developer.blender.org/rB6cf148227b220dd5087241ad01b6d2d6fe9afb80

WM: disable redraw timer in background mode

Crashing in background mode was reported as part of T78854,
disable via the poll function to give a useful error in background mode.

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

M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index a3d2d38136c..b8107a49a4c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3261,6 +3261,14 @@ static void redraw_timer_step(bContext *C,
   }
 }
 
+static bool redraw_timer_poll(bContext *C)
+{
+  /* Check background mode as many of these actions use redrawing.
+   * NOTE(@campbellbarton): if it's useful to support undo or animation step this could
+   * be allowed at the moment this seems like a corner case that isn't needed. */
+  return !G.background && WM_operator_winactive(C);
+}
+
 static int redraw_timer_exec(bContext *C, wmOperator *op)
 {
   Scene *scene = CTX_data_scene(C);
@@ -3322,7 +3330,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot)
 
   ot->invoke = WM_menu_invoke;
   ot->exec = redraw_timer_exec;
-  ot->poll = WM_operator_winactive;
+  ot->poll = redraw_timer_poll;
 
   ot->prop = RNA_def_enum(ot->srna, "type", redraw_timer_type_items, eRTDrawRegion, "Type", "");
   RNA_def_int(



More information about the Bf-blender-cvs mailing list