1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-10 05:30:01 +01:00

Remove some naked new amd delete in: various

This commit is contained in:
Paul Licameli
2016-04-08 04:32:11 -04:00
committed by Paul Licameli
parent 186679b3a6
commit 942c62b6f6
23 changed files with 165 additions and 251 deletions

View File

@@ -190,8 +190,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
: wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
mData(NULL),
mBitmap(NULL),
mAnalyst(new SpectrumAnalyst())
mAnalyst(std::make_unique<SpectrumAnalyst>())
{
SetName(GetTitle());
@@ -239,8 +238,8 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
axisChoices.Add(_("Log frequency"));
mFreqFont = wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
mArrowCursor = new wxCursor(wxCURSOR_ARROW);
mCrossCursor = new wxCursor(wxCURSOR_CROSS);
mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);
gPrefs->Read(wxT("/FreqWindow/DrawGrid"), &mDrawGrid, true);
@@ -515,12 +514,8 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
FreqWindow::~FreqWindow()
{
if (mBitmap)
delete mBitmap;
if (mData)
delete[] mData;
delete mArrowCursor;
delete mCrossCursor;
}
bool FreqWindow::Show(bool show)
@@ -622,15 +617,11 @@ void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
Layout();
if (mBitmap)
{
delete mBitmap;
mBitmap = NULL;
}
mBitmap.reset();
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = new wxBitmap(mPlotRect.width, mPlotRect.height);
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height);
dc.SelectObject(*mBitmap);