Browse Source

More mac plugin fixes for Reaper, Logic, Live.

tags/2021-05-28
jules 15 years ago
parent
commit
a38d1a05e2
4 changed files with 26 additions and 20 deletions
  1. +10
    -15
      extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm
  2. +2
    -3
      extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm
  3. +7
    -1
      juce_amalgamated.cpp
  4. +7
    -1
      src/native/mac/juce_mac_NSViewComponentPeer.mm

+ 10
- 15
extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm View File

@@ -1182,24 +1182,19 @@ public:
private:
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);
}
}
//==============================================================================


+ 2
- 3
extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm View File

@@ -29,13 +29,12 @@
#if JucePlugin_Build_VST
#include <Cocoa/Cocoa.h>
#define ADD_CARBON_BODGE 1 // see note below..
#include <Carbon/Carbon.h>
#include "../juce_PluginHeaders.h"
#define ADD_CARBON_BODGE 1 // see note below..
//==============================================================================
BEGIN_JUCE_NAMESPACE


+ 7
- 1
juce_amalgamated.cpp View File

@@ -257323,7 +257323,7 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
window = [[JuceNSWindow alloc] initWithContentRect: r
styleMask: style
backing: NSBackingStoreBuffered
defer: YES ];
defer: YES];

[((JuceNSWindow*) window) setOwner: this];
[window orderOut: nil];
@@ -257337,7 +257337,12 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
[window setContentView: view];
[window setAutodisplay: 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 retain];

[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0];
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0];
}
@@ -257355,6 +257360,7 @@ NSViewComponentPeer::~NSViewComponentPeer()
{
[((JuceNSWindow*) window) setOwner: 0];
[window close];
[window release];
}
}



+ 7
- 1
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -803,7 +803,7 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
window = [[JuceNSWindow alloc] initWithContentRect: r
styleMask: style
backing: NSBackingStoreBuffered
defer: YES ];
defer: YES];
[((JuceNSWindow*) window) setOwner: this];
[window orderOut: nil];
@@ -817,7 +817,12 @@ NSViewComponentPeer::NSViewComponentPeer (Component* const component,
[window setContentView: view];
[window setAutodisplay: 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 retain];
[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0];
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0];
}
@@ -835,6 +840,7 @@ NSViewComponentPeer::~NSViewComponentPeer()
{
[((JuceNSWindow*) window) setOwner: 0];
[window close];
[window release];
}
}


Loading…
Cancel
Save