Fix T60809: Crash undoing object rename in edit-mode
[blender.git] / source / blender / blenkernel / BKE_undo_system.h
index 9697c7dd8e2a184773a2a9744e03f379119bf751..dc8cabc52c721d179c9dc4ddded818bb3a124aea 100644 (file)
@@ -49,6 +49,11 @@ UNDO_REF_ID_TYPE(Text);
 typedef struct UndoStack {
        ListBase         steps;
        struct UndoStep *step_active;
 typedef struct UndoStack {
        ListBase         steps;
        struct UndoStep *step_active;
+       /**
+        * The last memfile state read, used so we can be sure the names from the
+        * library state matches the state an undo step was written in.
+        */
+       struct UndoStep *step_active_memfile;
 
        /**
         * Some undo systems require begin/end, see: #UndoType.step_encode_init
 
        /**
         * Some undo systems require begin/end, see: #UndoType.step_encode_init
@@ -135,8 +140,10 @@ extern const UndoType *BKE_UNDOSYS_TYPE_TEXT;
 UndoStack      *BKE_undosys_stack_create(void);
 void            BKE_undosys_stack_destroy(UndoStack *ustack);
 void            BKE_undosys_stack_clear(UndoStack *ustack);
 UndoStack      *BKE_undosys_stack_create(void);
 void            BKE_undosys_stack_destroy(UndoStack *ustack);
 void            BKE_undosys_stack_clear(UndoStack *ustack);
+void            BKE_undosys_stack_clear_active(UndoStack *ustack);
 bool            BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name);
 void            BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain);
 bool            BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name);
 void            BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain);
+void            BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C);
 UndoStep       *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut);
 UndoStep       *BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut);
 void            BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size_t memory_limit);
 UndoStep       *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut);
 UndoStep       *BKE_undosys_stack_init_or_active_with_type(UndoStack *ustack, const UndoType *ut);
 void            BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size_t memory_limit);
@@ -149,6 +156,7 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, struct bContext *C, cons
 bool BKE_undosys_step_push(UndoStack *ustack, struct bContext *C, const char *name);
 
 UndoStep *BKE_undosys_step_find_by_name_with_type(UndoStack *ustack, const char *name, const UndoType *ut);
 bool BKE_undosys_step_push(UndoStack *ustack, struct bContext *C, const char *name);
 
 UndoStep *BKE_undosys_step_find_by_name_with_type(UndoStack *ustack, const char *name, const UndoType *ut);
+UndoStep *BKE_undosys_step_find_by_type(UndoStack *ustack, const UndoType *ut);
 UndoStep *BKE_undosys_step_find_by_name(UndoStack *ustack, const char *name);
 
 bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack, struct bContext *C, UndoStep *us, bool use_skip);
 UndoStep *BKE_undosys_step_find_by_name(UndoStack *ustack, const char *name);
 
 bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack, struct bContext *C, UndoStep *us, bool use_skip);