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