From 74f8f1bb67ee6395b1c6d6633b49cbeae6eb386b Mon Sep 17 00:00:00 2001 From: IanCaio Date: Fri, 2 Apr 2021 19:04:07 -0300 Subject: [PATCH] Fixes bug in the AutomationPattern copy-ctor (#5968) On the AutomationPattern copy constructor, the automation nodes were copied from the origin pattern but their "owner pattern" pointers weren't updated. Thanks Dom for finding and reporting this bug. --- include/AutomationNode.h | 10 ++++++++++ src/core/AutomationPattern.cpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/include/AutomationNode.h b/include/AutomationNode.h index 307c5ed36c7..d65b7f42637 100644 --- a/include/AutomationNode.h +++ b/include/AutomationNode.h @@ -130,6 +130,16 @@ class AutomationNode m_outTangent = tangent; } + /** + * @brief Sets the pattern this node belongs to + * @param AutomationPattern* pattern that m_pattern will be + * set to + */ + inline void setPattern(AutomationPattern* pat) + { + m_pattern = pat; + } + private: // Pattern that this node belongs to AutomationPattern* m_pattern; diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index 12b9c00cfc7..a56e09af532 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -91,6 +91,8 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) : { // Copies the automation node (in/out values and in/out tangents) m_timeMap[POS(it)] = it.value(); + // Sets the node's pattern to this one + m_timeMap[POS(it)].setPattern(this); } if (!getTrack()){ return; } switch( getTrack()->trackContainer()->type() )