From c2ba5785ab3317c41588ee04e264a445b449dfd6 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 22 Jul 2009 08:30:51 +0000 Subject: [PATCH] fix for VST crash in Live when the plugin is deleted with its window still open --- extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm index c87b475034..8449ecc678 100644 --- a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm +++ b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm @@ -38,9 +38,7 @@ #define ADD_CARBON_BODGE 1 // see note below.. -#if ADD_CARBON_BODGE - #include -#endif +#include #include "../juce_PluginHeaders.h" @@ -148,6 +146,11 @@ void detachComponentFromWindowRef (Component* comp, void* nsWindow) comp->removeFromDesktop(); [hostWindow release]; + + // The event loop needs to be run between closing the window and deleting the plugin, + // presumably to let the cocoa objects get tidied up. Leaving out this line causes crashes + // in Live when you delete the plugin with its window open. + MessageManager::getInstance()->runDispatchLoopUntil (10); } void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight)