From 723c5256c0f1ca6390d486f2fba8af39e86ebfc5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 6 Jan 2020 10:33:14 -0500 Subject: [PATCH] Don't call GetActiveProject when constructing EffectUIHost... ... relying on guarantees in the previous commit --- src/effects/EffectUI.cpp | 8 +++++--- src/effects/EffectUI.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/effects/EffectUI.cpp b/src/effects/EffectUI.cpp index cf0253c1a..85c0d2225 100644 --- a/src/effects/EffectUI.cpp +++ b/src/effects/EffectUI.cpp @@ -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 dlg{ - safenew EffectUIHost{ &parent, pEffect, client} }; + safenew EffectUIHost{ &parent, *project, pEffect, client} }; if (dlg->Initialize()) { diff --git a/src/effects/EffectUI.h b/src/effects/EffectUI.h index fac23d5ed..38f87d78f 100644 --- a/src/effects/EffectUI.h +++ b/src/effects/EffectUI.h @@ -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();