1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

More of bug 1338: avoid Mac hang with modal invocation of plugin...

... This required a separate set of changes and testing for the VST version of
SPAN, another for the AU version.

see commit c8e570797f1e7c76750b4a8f24d4fb97c612f7e6
This commit is contained in:
Paul Licameli 2017-07-24 16:49:15 -04:00
parent 6ce85bee9a
commit 54afdc762f
7 changed files with 22 additions and 1 deletions

View File

@ -35,6 +35,7 @@ public:
~VSTControl(); ~VSTControl();
bool Create(wxWindow *parent, VSTEffectLink *link); bool Create(wxWindow *parent, VSTEffectLink *link);
void Close();
private: private:
void CreateCocoa(); void CreateCocoa();

View File

@ -65,6 +65,11 @@ VSTControl::VSTControl()
} }
VSTControl::~VSTControl() VSTControl::~VSTControl()
{
Close();
}
void VSTControl::Close()
{ {
#if !defined(_LP64) #if !defined(_LP64)
if (mWindowRef) if (mWindowRef)

View File

@ -1762,6 +1762,7 @@ bool VSTEffect::CloseUI()
#ifdef __WX_EVTLOOP_BUSY_WAITING__ #ifdef __WX_EVTLOOP_BUSY_WAITING__
wxEventLoop::SetBusyWaiting(false); wxEventLoop::SetBusyWaiting(false);
#endif #endif
mControl->Close();
#endif #endif
mParent->RemoveEventHandler(this); mParent->RemoveEventHandler(this);

View File

@ -33,6 +33,8 @@ public:
AUControl(); AUControl();
~AUControl(); ~AUControl();
void Close();
bool Create(wxWindow *parent, AudioComponent comp, AudioUnit unit, bool custom); bool Create(wxWindow *parent, AudioComponent comp, AudioUnit unit, bool custom);
void CreateCocoa(); void CreateCocoa();
void CreateGeneric(); void CreateGeneric();

View File

@ -107,12 +107,18 @@ AUControl::AUControl()
} }
AUControl::~AUControl() AUControl::~AUControl()
{
Close();
}
void AUControl::Close()
{ {
#if !defined(_LP64) #if !defined(_LP64)
if (mInstance) if (mInstance)
{ {
AudioComponentInstanceDispose(mInstance); AudioComponentInstanceDispose(mInstance);
mInstance = nullptr;
} }
#endif #endif
@ -125,11 +131,13 @@ AUControl::~AUControl()
object:mView]; object:mView];
[mView release]; [mView release];
mView = nullptr;
} }
if (mAUView) if (mAUView)
{ {
[mAUView release]; [mAUView release];
mAUView = nullptr;
} }
} }

View File

@ -1747,7 +1747,7 @@ bool AudioUnitEffect::PopulateUI(wxWindow *parent)
{ {
auto innerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL); auto innerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
innerSizer->Add(pControl.release(), 1, wxEXPAND); innerSizer->Add((mpControl = pControl.release()), 1, wxEXPAND);
container->SetSizer(innerSizer.release()); container->SetSizer(innerSizer.release());
} }
@ -1808,6 +1808,8 @@ bool AudioUnitEffect::CloseUI()
#ifdef __WX_EVTLOOP_BUSY_WAITING__ #ifdef __WX_EVTLOOP_BUSY_WAITING__
wxEventLoop::SetBusyWaiting(false); wxEventLoop::SetBusyWaiting(false);
#endif #endif
if (mpControl)
mpControl->Close(), mpControl = nullptr;
#endif #endif
mParent->RemoveEventHandler(this); mParent->RemoveEventHandler(this);

View File

@ -211,6 +211,8 @@ private:
AUEventListenerRef mEventListenerRef; AUEventListenerRef mEventListenerRef;
AUControl *mpControl{};
friend class AudioUnitEffectExportDialog; friend class AudioUnitEffectExportDialog;
friend class AudioUnitEffectImportDialog; friend class AudioUnitEffectImportDialog;
}; };