diff --git a/src/common/serialization/vst3/event-list.cpp b/src/common/serialization/vst3/event-list.cpp index 34b1ef50..40669c57 100644 --- a/src/common/serialization/vst3/event-list.cpp +++ b/src/common/serialization/vst3/event-list.cpp @@ -227,21 +227,10 @@ tresult PLUGIN_API YaEventList::getEvent(int32 index, return Steinberg::kInvalidArgument; } - // On the first call to this, we'll reconstruct `Event` objects out of our - // `YaEvent`s all at once. This is also done if for whatever reason the - // plugin `getEvent()`s an event it just added. - const size_t num_already_reconstructed_events = reconstructed_events.size(); - if (index >= static_cast(num_already_reconstructed_events)) { - reconstructed_events.resize(events.size()); - std::transform( - events.begin() + static_cast(num_already_reconstructed_events), - events.end(), - reconstructed_events.begin() + - static_cast(num_already_reconstructed_events), - [](const YaEvent& event) { return event.get(); }); - } - - e = reconstructed_events[index]; + // Reconstructing an event is cheap, but some events may contain pointers to + // heap data stored within the `events` vector so this event will still have + // the same lifetime as this class + e = events[index].get(); return Steinberg::kResultOk; } diff --git a/src/common/serialization/vst3/event-list.h b/src/common/serialization/vst3/event-list.h index a1c04dde..02a9c97b 100644 --- a/src/common/serialization/vst3/event-list.h +++ b/src/common/serialization/vst3/event-list.h @@ -257,21 +257,10 @@ class YaEventList : public Steinberg::Vst::IEventList { template void serialize(S& s) { s.container(events, 1 << 16); - - // NOTE: After deserializing events, we need to make sure to clear our - // caches since those may still contain old events - reconstructed_events.clear(); } private: boost::container::small_vector events; - - /** - * On the first `getEvent()` call we'll reconstruct these from `events` all - * at once. These event objects may not outlive this event list. - */ - boost::container::small_vector - reconstructed_events; }; #pragma GCC diagnostic pop