Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-04-26 12:18:51 +0300
committerCampbell Barton <campbell@blender.org>2022-04-26 12:21:12 +0300
commit6cf148227b220dd5087241ad01b6d2d6fe9afb80 (patch)
tree0966e10c18bb1a057258318284768bff1bfdfaee
parent2492d9852bb33aa7209f0a297a117488b0a39cfd (diff)
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.
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c10
1 files changed, 9 insertions, 1 deletions
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(