mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-25 08:58:06 +02:00
Reviewed uses of release(); prefer Destroy_ptr to hold window objects
This commit is contained in:
parent
7927fe065f
commit
82dd7545c9
@ -5609,7 +5609,8 @@ void AudacityProject::OnPlotSpectrum()
|
||||
where.x = 150;
|
||||
where.y = 150;
|
||||
|
||||
mFreqWindow = safenew FreqWindow(this, -1, _("Frequency Analysis"), where);
|
||||
mFreqWindow.reset( safenew FreqWindow(
|
||||
this, -1, _("Frequency Analysis"), where ) );
|
||||
}
|
||||
|
||||
mFreqWindow->Show(true);
|
||||
@ -5626,7 +5627,8 @@ void AudacityProject::OnContrast()
|
||||
where.x = 150;
|
||||
where.y = 150;
|
||||
|
||||
mContrastDialog = safenew ContrastDialog(this, -1, _("Contrast Analysis (WCAG 2 compliance)"), where);
|
||||
mContrastDialog.reset( safenew ContrastDialog(
|
||||
this, -1, _("Contrast Analysis (WCAG 2 compliance)"), where ) );
|
||||
}
|
||||
|
||||
mContrastDialog->CentreOnParent();
|
||||
|
@ -2482,15 +2482,8 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||
// Streams can be for play, recording, or monitoring. But maybe it still
|
||||
// makes sense to stop any recording before putting up the dialog.
|
||||
|
||||
if (mFreqWindow) {
|
||||
mFreqWindow->Destroy();
|
||||
mFreqWindow = NULL;
|
||||
}
|
||||
|
||||
if (mContrastDialog) {
|
||||
mContrastDialog->Destroy();
|
||||
mContrastDialog = NULL;
|
||||
}
|
||||
mFreqWindow.reset();
|
||||
mContrastDialog.reset();
|
||||
|
||||
// Check to see if we were playing or recording
|
||||
// audio, and if so, make sure Audio I/O is completely finished.
|
||||
|
@ -630,8 +630,8 @@ private:
|
||||
MixerBoard* mMixerBoard{};
|
||||
MixerBoardFrame* mMixerBoardFrame{};
|
||||
|
||||
FreqWindow *mFreqWindow{};
|
||||
ContrastDialog *mContrastDialog{};
|
||||
Destroy_ptr<FreqWindow> mFreqWindow;
|
||||
Destroy_ptr<ContrastDialog> mContrastDialog;
|
||||
|
||||
// dialog for missing alias warnings
|
||||
wxDialog *mAliasMissingWarningDialog{};
|
||||
|
@ -447,7 +447,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
// wxWidgets owns the accessible object
|
||||
SetAccessible(mAx = pAx.release());
|
||||
#else
|
||||
// wxWidgets doesn not own the object, but we need to retain it
|
||||
// wxWidgets does not own the object, but we need to retain it
|
||||
mAx = std::move(pAx);
|
||||
#endif
|
||||
}
|
||||
|
@ -2715,7 +2715,7 @@ void VSTEffect::BuildFancy()
|
||||
// Turn the power on...some effects need this when the editor is open
|
||||
PowerOn();
|
||||
|
||||
auto control = std::make_unique<VSTControl>();
|
||||
auto control = Destroy_ptr<VSTControl>{ safenew VSTControl };
|
||||
if (!control)
|
||||
{
|
||||
return;
|
||||
|
@ -1729,7 +1729,7 @@ bool AudioUnitEffect::PopulateUI(wxWindow *parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pControl = std::make_unique<AUControl>();
|
||||
auto pControl = Destroy_ptr<AUControl>( safenew AUControl );
|
||||
if (!pControl)
|
||||
{
|
||||
return false;
|
||||
|
@ -1398,7 +1398,9 @@ bool LV2Effect::BuildFancy()
|
||||
// Use a panel to host the plugins GUI
|
||||
// container is owned by mParent, but we may destroy it if there are
|
||||
// any errors before completing the build of UI.
|
||||
auto container = std::make_unique<wxPanelWrapper>(mParent, wxID_ANY);
|
||||
auto container = Destroy_ptr<wxPanelWrapper>{
|
||||
safenew wxPanelWrapper{ mParent, wxID_ANY}
|
||||
};
|
||||
if (!container)
|
||||
{
|
||||
lilv_uis_free(uis);
|
||||
|
Loading…
x
Reference in New Issue
Block a user