From cb0b152b35d42817ec7ebf3eb859b7ef11205dee Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 2 Mar 2021 19:05:58 +0100 Subject: [PATCH] VST3: Fix MSVC related crashes Do not simply allocate std::vector<> space but also initialize elements. The data is later accessed as C-pointer array: &var[0]. With most compilers simply reserving space in the vector is sufficient in order to later access the elements directly. However actually placing objects in the vector before referencing them is more correct. --- libs/ardour/vst3_plugin.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index 05f3961b33..c5deebc8f2 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -1077,8 +1077,8 @@ VST3PI::VST3PI (boost::shared_ptr m, std::string uniqu _n_bus_in = _component->getBusCount (Vst::kAudio, Vst::kInput); _n_bus_out = _component->getBusCount (Vst::kAudio, Vst::kOutput); - _busbuf_in.reserve (_n_bus_in); - _busbuf_out.reserve (_n_bus_out); + _busbuf_in.resize (_n_bus_in); + _busbuf_out.resize (_n_bus_out); /* do not re-order, _io_name is build in sequence */ _n_inputs = count_channels (Vst::kAudio, Vst::kInput, Vst::kMain);