diff --git a/include/Lv2Options.h b/include/Lv2Options.h index ca4fe2b7f..603cdda43 100644 --- a/include/Lv2Options.h +++ b/include/Lv2Options.h @@ -84,6 +84,8 @@ public: return m_options.data(); } + void clear(); + private: //! Initialize an option internally void initOption(LV2_URID key, diff --git a/include/Lv2Proc.h b/include/Lv2Proc.h index 76fa5eec2..7cfa5f7a8 100644 --- a/include/Lv2Proc.h +++ b/include/Lv2Proc.h @@ -175,7 +175,7 @@ private: bool m_valid = true; const LilvPlugin* m_plugin; - LilvInstance* m_instance; + LilvInstance* m_instance = nullptr; Lv2Features m_features; // options diff --git a/src/core/lv2/Lv2Features.cpp b/src/core/lv2/Lv2Features.cpp index c8fc05465..25ee11544 100644 --- a/src/core/lv2/Lv2Features.cpp +++ b/src/core/lv2/Lv2Features.cpp @@ -109,7 +109,12 @@ void *&Lv2Features::operator[](const char *featName) void Lv2Features::clear() { - m_featureByUri.clear(); + m_features.clear(); + for (auto& [uri, feature] : m_featureByUri) + { + (void) uri; + feature = nullptr; + } } diff --git a/src/core/lv2/Lv2Options.cpp b/src/core/lv2/Lv2Options.cpp index 36281ee63..7b4528cb6 100644 --- a/src/core/lv2/Lv2Options.cpp +++ b/src/core/lv2/Lv2Options.cpp @@ -94,6 +94,16 @@ void Lv2Options::initOption(LV2_URID key, uint32_t size, LV2_URID type, } + + +void Lv2Options::clear() +{ + m_options.clear(); + m_optionValues.clear(); + m_optionByUrid.clear(); +} + + } // namespace lmms #endif // LMMS_HAVE_LV2 diff --git a/src/core/lv2/Lv2Proc.cpp b/src/core/lv2/Lv2Proc.cpp index bd89cea0a..1dfb0e099 100644 --- a/src/core/lv2/Lv2Proc.cpp +++ b/src/core/lv2/Lv2Proc.cpp @@ -477,6 +477,7 @@ void Lv2Proc::shutdownPlugin() m_instance = nullptr; m_features.clear(); + m_options.clear(); } m_valid = true; }