From 31f4d8a2ca32ce2e4cd6a80b71a94013c1d53f18 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 2 Feb 2022 15:03:12 -0700 Subject: [PATCH] PatchChange: fix operator=() implementation which failed to manage event buffer ownership correctly --- libs/evoral/evoral/PatchChange.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/evoral/evoral/PatchChange.h b/libs/evoral/evoral/PatchChange.h index 7772d82c78..4b9bc2df59 100644 --- a/libs/evoral/evoral/PatchChange.h +++ b/libs/evoral/evoral/PatchChange.h @@ -74,6 +74,15 @@ public: unset (); } + PatchChange& operator= (PatchChange const & other) { + /* Need to be careful with assignment here, due to buffer + ownership issues etc. + */ + _bank_change_msb.set (other._bank_change_msb.buffer(), 3, other.time()); + _bank_change_lsb.set (other._bank_change_lsb.buffer(), 3, other.time()); + _program_change.set (other._program_change.buffer(), 2, other.time()); + return *this; + } void unset() { _bank_change_msb.buffer()[1] = 0xf; /* unset */ _bank_change_lsb.buffer()[1] = 0xf; /* unset */