diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index 77f59bd1c..808b4d548 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -185,6 +185,7 @@ public: fUiServer(this), fLastScaleFactor(1.0f), fLastProjectFolder(), + fPluginDeleterMutex(), fOptionsForced(false) { carla_debug("CarlaEngineNative::CarlaEngineNative()"); @@ -1379,6 +1380,11 @@ protected: static_cast(kUiHeight * fLastScaleFactor + 0.5f), nullptr, 0.0f); } + + { + const CarlaMutexLocker cml(fPluginDeleterMutex); + pData->deletePluginsAsNeeded(); + } } void uiSetParameterValue(const uint32_t index, const float value) @@ -1518,6 +1524,11 @@ protected: removeAllPlugins(); fIsRunning = true; + { + const CarlaMutexLocker cml(fPluginDeleterMutex); + pData->deletePluginsAsNeeded(); + } + // stopped during removeAllPlugins() if (! pData->thread.isThreadRunning()) pData->thread.startThread(); @@ -1700,6 +1711,7 @@ private: float fParameters[kNumInParams+kNumOutParams]; float fLastScaleFactor; CarlaString fLastProjectFolder; + CarlaMutex fPluginDeleterMutex; bool fOptionsForced;