From 42b8156cf64ff6bccf567a5fc3ebb2e64f8d4690 Mon Sep 17 00:00:00 2001 From: hogliux Date: Thu, 22 Sep 2016 10:58:16 +0100 Subject: [PATCH] Fixed crashes in old 32-bit Carbon plugin editor windows when running in macOS Sierra --- modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm | 6 +++++- modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index 4496f07ef2..a0cba6f8cb 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -2023,7 +2023,11 @@ private: WindowRef windowRef = HIViewGetWindow (parentHIView); hostWindow = [[NSWindow alloc] initWithWindowRef: windowRef]; - [hostWindow retain]; + // not really sure why this is needed in older OS X versions + // but JUCE plug-ins crash without it + if ((SystemStats::getOperatingSystemType() & 0xff) < 12) + [hostWindow retain]; + [hostWindow setCanHide: YES]; [hostWindow setReleasedWhenClosed: YES]; diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm index 929b31ea47..c510e8fb77 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm @@ -69,7 +69,7 @@ static pascal OSStatus viewBoundsChangedEvent (EventHandlerCallRef, EventRef, vo static bool shouldManuallyCloseHostWindow() { - return getHostType().isCubase7orLater() || getHostType().isRenoise(); + return getHostType().isCubase7orLater() || getHostType().isRenoise() || ((SystemStats::getOperatingSystemType() & 0xff) >= 12); } #endif