From 1e7afea2bb236ad9281e0d4a3f0342a04cab65c9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Jul 2020 15:36:11 +0200 Subject: Fix T78835: Ghosting audio after using undo The root of the issue comes to the fact that sub-data pointers were used to match strips before/after copy-on-write. The undo system might re-use sub-data pointers after re-allocating them, making it so that, for example, pointer used by sound strip is later re-used by video strip. This fix takes an advantage of recently introduced per-sequence UUID and uses it to match sequences before/after copy-on-write. --- .../depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc | 10 ++++++++-- .../depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc index 2780938fe05..ba7d20c0ba8 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc @@ -26,6 +26,8 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "BLI_assert.h" + #include "BKE_sequencer.h" #include "BKE_sound.h" @@ -43,7 +45,9 @@ void SequencerBackup::init_from_scene(Scene *scene) SequenceBackup sequence_backup(depsgraph); sequence_backup.init_from_sequence(sequence); if (!sequence_backup.isEmpty()) { - sequences_backup.add(sequence->orig_sequence, sequence_backup); + const SessionUUID &session_uuid = sequence->runtime.session_uuid; + BLI_assert(BLI_session_uuid_is_generated(&session_uuid)); + sequences_backup.add(session_uuid, sequence_backup); } } SEQ_END; @@ -53,7 +57,9 @@ void SequencerBackup::restore_to_scene(Scene *scene) { Sequence *sequence; SEQ_BEGIN (scene->ed, sequence) { - SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(sequence->orig_sequence); + const SessionUUID &session_uuid = sequence->runtime.session_uuid; + BLI_assert(BLI_session_uuid_is_generated(&session_uuid)); + SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(session_uuid); if (sequence_backup != nullptr) { sequence_backup->restore_to_sequence(sequence); } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h index 9fe38ec270c..4419238da32 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h @@ -23,6 +23,10 @@ #pragma once +#include "DNA_session_uuid_types.h" + +#include "BLI_session_uuid.h" + #include "intern/depsgraph_type.h" #include "intern/eval/deg_eval_runtime_backup_sequence.h" @@ -43,7 +47,7 @@ class SequencerBackup { const Depsgraph *depsgraph; - Map sequences_backup; + Map sequences_backup; }; } // namespace deg -- cgit v1.2.3