@@ -1182,24 +1182,19 @@ public: | |||||
private: | private: | ||||
void deleteUI() | void deleteUI() | ||||
{ | { | ||||
PopupMenu::dismissAllActiveMenus(); | |||||
// there's some kind of component currently modal, but the host | |||||
// is trying to delete our plugin.. | |||||
jassert (Component::getCurrentlyModalComponent() == 0); | |||||
if (windowComp != 0) | |||||
{ | |||||
PopupMenu::dismissAllActiveMenus(); | |||||
if (windowComp != 0 && windowComp->getChildComponent(0) != 0) | |||||
juceFilter->editorBeingDeleted ((AudioProcessorEditor*) windowComp->getChildComponent(0)); | |||||
// there's some kind of component currently modal, but the host | |||||
// is trying to delete our plugin.. | |||||
jassert (Component::getCurrentlyModalComponent() == 0); | |||||
deleteAndZero (windowComp); | |||||
if (windowComp != 0 && windowComp->getChildComponent(0) != 0) | |||||
juceFilter->editorBeingDeleted ((AudioProcessorEditor*) windowComp->getChildComponent(0)); | |||||
// 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 Reaper when you delete the plugin with its window open. | |||||
// (Doing it this way rather than using a single longer timout means that we can guarantee | |||||
// how many messages will be dispatched, which seems to be vital in Reaper) | |||||
for (int i = 20; --i >= 0;) | |||||
MessageManager::getInstance()->runDispatchLoopUntil (1); | |||||
deleteAndZero (windowComp); | |||||
} | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -29,13 +29,12 @@ | |||||
#if JucePlugin_Build_VST | #if JucePlugin_Build_VST | ||||
#include <Cocoa/Cocoa.h> | #include <Cocoa/Cocoa.h> | ||||
#define ADD_CARBON_BODGE 1 // see note below.. | |||||
#include <Carbon/Carbon.h> | #include <Carbon/Carbon.h> | ||||
#include "../juce_PluginHeaders.h" | #include "../juce_PluginHeaders.h" | ||||
#define ADD_CARBON_BODGE 1 // see note below.. | |||||
//============================================================================== | //============================================================================== | ||||
BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
@@ -257323,7 +257323,7 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component, | |||||
window = [[JuceNSWindow alloc] initWithContentRect: r | window = [[JuceNSWindow alloc] initWithContentRect: r | ||||
styleMask: style | styleMask: style | ||||
backing: NSBackingStoreBuffered | backing: NSBackingStoreBuffered | ||||
defer: YES ]; | |||||
defer: YES]; | |||||
[((JuceNSWindow*) window) setOwner: this]; | [((JuceNSWindow*) window) setOwner: this]; | ||||
[window orderOut: nil]; | [window orderOut: nil]; | ||||
@@ -257337,7 +257337,12 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component, | |||||
[window setContentView: view]; | [window setContentView: view]; | ||||
[window setAutodisplay: YES]; | [window setAutodisplay: YES]; | ||||
[window setAcceptsMouseMovedEvents: YES]; | [window setAcceptsMouseMovedEvents: YES]; | ||||
// We'll both retain and also release this on closing because plugin hosts can unexpectedly | |||||
// close the window for us, and also tend to get cause trouble if setReleasedWhenClosed is NO. | |||||
[window setReleasedWhenClosed: YES]; | [window setReleasedWhenClosed: YES]; | ||||
[window retain]; | |||||
[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0]; | [window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0]; | ||||
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0]; | [window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0]; | ||||
} | } | ||||
@@ -257355,6 +257360,7 @@ NSViewComponentPeer::~NSViewComponentPeer() | |||||
{ | { | ||||
[((JuceNSWindow*) window) setOwner: 0]; | [((JuceNSWindow*) window) setOwner: 0]; | ||||
[window close]; | [window close]; | ||||
[window release]; | |||||
} | } | ||||
} | } | ||||
@@ -803,7 +803,7 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component, | |||||
window = [[JuceNSWindow alloc] initWithContentRect: r | window = [[JuceNSWindow alloc] initWithContentRect: r | ||||
styleMask: style | styleMask: style | ||||
backing: NSBackingStoreBuffered | backing: NSBackingStoreBuffered | ||||
defer: YES ]; | |||||
defer: YES]; | |||||
[((JuceNSWindow*) window) setOwner: this]; | [((JuceNSWindow*) window) setOwner: this]; | ||||
[window orderOut: nil]; | [window orderOut: nil]; | ||||
@@ -817,7 +817,12 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component, | |||||
[window setContentView: view]; | [window setContentView: view]; | ||||
[window setAutodisplay: YES]; | [window setAutodisplay: YES]; | ||||
[window setAcceptsMouseMovedEvents: YES]; | [window setAcceptsMouseMovedEvents: YES]; | ||||
// We'll both retain and also release this on closing because plugin hosts can unexpectedly | |||||
// close the window for us, and also tend to get cause trouble if setReleasedWhenClosed is NO. | |||||
[window setReleasedWhenClosed: YES]; | [window setReleasedWhenClosed: YES]; | ||||
[window retain]; | |||||
[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0]; | [window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0]; | ||||
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0]; | [window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0]; | ||||
} | } | ||||
@@ -835,6 +840,7 @@ NSViewComponentPeer::~NSViewComponentPeer() | |||||
{ | { | ||||
[((JuceNSWindow*) window) setOwner: 0]; | [((JuceNSWindow*) window) setOwner: 0]; | ||||
[window close]; | [window close]; | ||||
[window release]; | |||||
} | } | ||||
} | } | ||||