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:
Diffstat (limited to 'source/blender/editors/undo')
-rw-r--r--source/blender/editors/undo/ed_undo.c10
-rw-r--r--source/blender/editors/undo/undo_intern.h5
2 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 6633e1c427c..50e0bb1f1c2 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -98,6 +98,14 @@ void ED_undo_push(bContext *C, const char *str)
if (steps <= 0) {
return;
}
+ if (G.background) {
+ /* Python developers may have explicitly created the undo stack in background mode,
+ * otherwise allow it to be NULL, see: T60934.
+ * Otherwise it must never be NULL, even when undo is disabled. */
+ if (wm->undo_stack == NULL) {
+ return;
+ }
+ }
/* Only apply limit if this is the last undo step. */
if (wm->undo_stack->step_active && (wm->undo_stack->step_active->next == NULL)) {
@@ -360,7 +368,7 @@ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id)
CLOG_INFO(&LOG, 1, "skipping undo for paint-mode");
return false;
}
- else if (obact->mode & OB_MODE_EDIT) {
+ if (obact->mode & OB_MODE_EDIT) {
if ((id == NULL) || (obact->data == NULL) ||
(GS(id->name) != GS(((ID *)obact->data)->name))) {
/* No undo push on id type mismatch in edit-mode. */
diff --git a/source/blender/editors/undo/undo_intern.h b/source/blender/editors/undo/undo_intern.h
index 8184e7bfbdc..660f1a5b57d 100644
--- a/source/blender/editors/undo/undo_intern.h
+++ b/source/blender/editors/undo/undo_intern.h
@@ -18,8 +18,7 @@
* \ingroup edundo
*/
-#ifndef __UNDO_INTERN_H__
-#define __UNDO_INTERN_H__
+#pragma once
/* internal exports only */
@@ -27,5 +26,3 @@ struct UndoType;
/* memfile_undo.c */
void ED_memfile_undosys_type(struct UndoType *ut);
-
-#endif /* __UNDO_INTERN_H__ */