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

Don't call GetActiveProject when constructing EffectUIHost...

... relying on guarantees in the previous commit
This commit is contained in:
Paul Licameli 2020-01-06 10:33:14 -05:00
parent bb26b2f2c4
commit 723c5256c0
2 changed files with 7 additions and 3 deletions

View File

@ -717,6 +717,7 @@ EVT_MENU_RANGE(kFactoryPresetsID, kFactoryPresetsID + 999, EffectUIHost::OnFacto
END_EVENT_TABLE()
EffectUIHost::EffectUIHost(wxWindow *parent,
AudacityProject &project,
Effect *effect,
EffectUIClientInterface *client)
: wxDialogWrapper(parent, wxID_ANY, effect->GetName(),
@ -736,7 +737,7 @@ EffectUIHost::EffectUIHost(wxWindow *parent,
mCommand = NULL;
mClient = client;
mProject = GetActiveProject();
mProject = &project;
mInitialized = false;
mSupportsRealtime = false;
@ -750,6 +751,7 @@ EffectUIHost::EffectUIHost(wxWindow *parent,
}
EffectUIHost::EffectUIHost(wxWindow *parent,
AudacityProject &project,
AudacityCommand *command,
EffectUIClientInterface *client)
: wxDialogWrapper(parent, wxID_ANY, XO("Some Command") /*command->GetName()*/,
@ -769,7 +771,7 @@ EffectUIHost::EffectUIHost(wxWindow *parent,
mCommand = command;
mClient = client;
mProject = GetActiveProject();
mProject = &project;
mInitialized = false;
mSupportsRealtime = false;
@ -1828,7 +1830,7 @@ wxDialog *EffectUI::DialogFactory( wxWindow &parent, EffectHostInterface *pHost,
return nullptr;
Destroy_ptr<EffectUIHost> dlg{
safenew EffectUIHost{ &parent, pEffect, client} };
safenew EffectUIHost{ &parent, *project, pEffect, client} };
if (dlg->Initialize())
{

View File

@ -120,9 +120,11 @@ class EffectUIHost final : public wxDialogWrapper,
public:
// constructors and destructors
EffectUIHost(wxWindow *parent,
AudacityProject &project,
Effect *effect,
EffectUIClientInterface *client);
EffectUIHost(wxWindow *parent,
AudacityProject &project,
AudacityCommand *command,
EffectUIClientInterface *client);
virtual ~EffectUIHost();