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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-08-08 10:08:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-08 10:12:44 +0300
commitb496bf022bc48fd759e4848edf93d181985e31ad (patch)
tree97e3bd063fe151d92968a6336b3cfe2774581362 /source
parentbb8497fd5d4a647c0b7221ed965dc58c9547a820 (diff)
Fix T54584: Crash w/ image undo
Using accumulation undo type (eg painting) as the first undo step, broke code which adds an initial memfile undo.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/undo_system.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index ba7d432fab3..2231f43c9c3 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -254,6 +254,7 @@ void BKE_undosys_stack_clear_active(UndoStack *ustack)
static bool undosys_stack_push_main(UndoStack *ustack, const char *name, struct Main *bmain)
{
UNDO_NESTED_ASSERT(false);
+ BLI_assert(ustack->step_init == NULL);
CLOG_INFO(&LOG, 1, "'%s'", name);
bContext *C_temp = CTX_create();
CTX_data_main_set(C_temp, bmain);
@@ -434,7 +435,13 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char
Main *bmain = G.main;
if (bmain->is_memfile_undo_written == false) {
const char *name_internal = "MemFile Internal";
- if (undosys_stack_push_main(ustack, name_internal, bmain)) {
+ /* Don't let 'step_init' cause issues when adding memfile undo step. */
+ void *step_init = ustack->step_init;
+ ustack->step_init = NULL;
+ const bool ok = undosys_stack_push_main(ustack, name_internal, bmain);
+ /* Restore 'step_init'. */
+ ustack->step_init = step_init;
+ if (ok) {
UndoStep *us = ustack->steps.last;
BLI_assert(STREQ(us->name, name_internal));
us->skip = true;