Exception safety in: overrides of ShowInterface

This commit is contained in:
Paul Licameli 2016-12-16 15:32:56 -05:00
parent 79c3bef2ce
commit 1fad6292a2
7 changed files with 31 additions and 22 deletions

View File

@ -88,8 +88,6 @@ WX_DECLARE_VOIDPTR_HASH_MAP( bool, t2bHash );
Effect::Effect()
{
mParent = NULL;
mClient = NULL;
mTracks = NULL;
@ -520,7 +518,8 @@ bool Effect::ShowInterface(wxWindow *parent, bool forceModal)
if (mUIDialog)
{
mUIDialog->Close(true);
if ( mUIDialog->Close(true) )
mUIDialog = nullptr;
return false;
}
@ -529,8 +528,9 @@ bool Effect::ShowInterface(wxWindow *parent, bool forceModal)
return mClient->ShowInterface(parent, forceModal);
}
mParent = parent;
// mUIDialog is null
auto cleanup = valueRestorer( mUIDialog );
mUIDialog = CreateUI(parent, this);
if (!mUIDialog)
{
@ -544,14 +544,13 @@ bool Effect::ShowInterface(wxWindow *parent, bool forceModal)
if (SupportsRealtime() && !forceModal)
{
mUIDialog->Show();
cleanup.release();
// Return false to bypass effect processing
return false;
}
bool res = mUIDialog->ShowModal() != 0;
mUIDialog = NULL;
mParent = NULL;
return res;
}
@ -1131,7 +1130,6 @@ bool Effect::DoEffect(wxWindow *parent,
mFactory = factory;
mProjectRate = projectRate;
mParent = parent;
mTracks = list;
bool isSelection = false;

View File

@ -484,7 +484,6 @@ protected:
// Used only by the base Effect class
//
private:
wxWindow *mParent;
TrackList *mTracks; // the complete list of all tracks
bool mIsBatch;

View File

@ -570,14 +570,10 @@ bool EffectEqualization::PopulateUI(wxWindow *parent)
bool EffectEqualization::CloseUI()
{
mUIParent->RemoveEventHandler(this);
mUIParent = NULL;
mCurve = NULL;
mPanel = NULL;
return true;
return Effect::CloseUI();
}
void EffectEqualization::PopulateOrExchange(ShuttleGui & S)

View File

@ -1544,10 +1544,14 @@ bool VSTEffect::ShowInterface(wxWindow *parent, bool forceModal)
{
if (mDialog)
{
mDialog->Close(true);
if ( mDialog->Close(true) )
mDialog = nullptr;
return false;
}
// mDialog is null
auto cleanup = valueRestorer( mDialog );
// mProcessLevel = 1; // in GUI thread
// Set some defaults since some VSTs need them...these will be reset when
@ -1569,12 +1573,12 @@ bool VSTEffect::ShowInterface(wxWindow *parent, bool forceModal)
if (SupportsRealtime() && !forceModal)
{
mDialog->Show();
cleanup.release();
return false;
}
bool res = mDialog->ShowModal() != 0;
mDialog = NULL;
return res;
}

View File

@ -1423,10 +1423,14 @@ bool AudioUnitEffect::ShowInterface(wxWindow *parent, bool forceModal)
{
if (mDialog)
{
mDialog->Close(true);
if( mDialog->Close(true) )
mDialog = nullptr;
return false;
}
// mDialog is null
auto cleanup = valueRestorer( mDialog );
mDialog = mHost->CreateUI(parent, this);
if (!mDialog)
{
@ -1436,12 +1440,12 @@ bool AudioUnitEffect::ShowInterface(wxWindow *parent, bool forceModal)
if ((SupportsRealtime() || GetType() == EffectTypeAnalyze) && !forceModal)
{
mDialog->Show();
cleanup.release();
return false;
}
bool res = mDialog->ShowModal() != 0;
mDialog = NULL;
return res;
}

View File

@ -996,10 +996,14 @@ bool LadspaEffect::ShowInterface(wxWindow *parent, bool forceModal)
{
if (mDialog)
{
mDialog->Close(true);
if ( mDialog->Close(true) )
mDialog = nullptr;
return false;
}
// mDialog is null
auto cleanup = valueRestorer( mDialog );
mDialog = mHost->CreateUI(parent, this);
if (!mDialog)
{
@ -1013,12 +1017,12 @@ bool LadspaEffect::ShowInterface(wxWindow *parent, bool forceModal)
if ((SupportsRealtime() || GetType() == EffectTypeAnalyze) && !forceModal)
{
mDialog->Show();
cleanup.release();
return false;
}
bool res = mDialog->ShowModal() != 0;
mDialog = NULL;
return res;
}

View File

@ -921,10 +921,14 @@ bool LV2Effect::ShowInterface(wxWindow *parent, bool forceModal)
{
if (mDialog)
{
mDialog->Close(true);
if ( mDialog->Close(true) )
mDialog = nullptr;
return false;
}
// mDialog is null
auto cleanup = valueRestorer( mDialog );
mDialog = mHost->CreateUI(parent, this);
if (!mDialog)
{
@ -939,12 +943,12 @@ bool LV2Effect::ShowInterface(wxWindow *parent, bool forceModal)
if ((SupportsRealtime() || GetType() == EffectTypeAnalyze) && !forceModal)
{
mDialog->Show();
cleanup.release();
return false;
}
bool res = mDialog->ShowModal() != 0;
mDialog = NULL;
return res;
}