1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 09:07:41 +02:00

Remove more naked news by editing comments, safenew and make_unique

This commit is contained in:
Paul Licameli 2016-08-08 10:08:38 -04:00
commit 6b9d69f3f8
25 changed files with 55 additions and 49 deletions

View File

@ -522,7 +522,7 @@ struct AudioIO::ScrubQueue
mDebt += deficit; mDebt += deficit;
auto toDiscard = mDebt - mMaxDebt; auto toDiscard = mDebt - mMaxDebt;
while (toDiscard > 0 && mMiddleIdx != mLeadingIdx) { while (toDiscard > 0 && mMiddleIdx != mLeadingIdx) {
// Cancel some debt (discard some new work) // Cancel some debt (discard some NEW work)
auto &entry = mEntries[mMiddleIdx]; auto &entry = mEntries[mMiddleIdx];
auto &dur = entry.mDuration; auto &dur = entry.mDuration;
if (toDiscard >= dur) { if (toDiscard >= dur) {

View File

@ -164,7 +164,7 @@ class AUDACITY_DLL_API AudioIO final {
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
bool IsScrubbing() { return IsBusy() && mScrubQueue != 0; } bool IsScrubbing() { return IsBusy() && mScrubQueue != 0; }
/** \brief enqueue a NEW scrub play interval, using the last end as the new start, /** \brief enqueue a NEW scrub play interval, using the last end as the NEW start,
* to be played over the same duration, as between this and the last * to be played over the same duration, as between this and the last
* enqueuing (or the starting of the stream). Except, we do not exceed maximum * enqueuing (or the starting of the stream). Except, we do not exceed maximum
* scrub speed, so may need to adjust either the start or the end. * scrub speed, so may need to adjust either the start or the end.

View File

@ -2740,7 +2740,8 @@ void LabelTrack::CreateCustomGlyphs()
// Create the icon from the tweaked spec. // Create the icon from the tweaked spec.
mBoundaryGlyphs[index] = wxBitmap(XmpBmp); mBoundaryGlyphs[index] = wxBitmap(XmpBmp);
// Create the mask // Create the mask
mBoundaryGlyphs[index].SetMask(new wxMask(mBoundaryGlyphs[index], wxColour(192, 192, 192))); // SetMask takes ownership
mBoundaryGlyphs[index].SetMask(safenew wxMask(mBoundaryGlyphs[index], wxColour(192, 192, 192)));
} }
} }

View File

@ -5370,7 +5370,7 @@ void AudacityProject::OnShowClipping()
void AudacityProject::OnHistory() void AudacityProject::OnHistory()
{ {
if (!mHistoryWindow) if (!mHistoryWindow)
mHistoryWindow = new HistoryWindow(this, GetUndoManager()); mHistoryWindow = safenew HistoryWindow(this, GetUndoManager());
mHistoryWindow->Show(); mHistoryWindow->Show();
mHistoryWindow->Raise(); mHistoryWindow->Raise();
mHistoryWindow->UpdateDisplay(); mHistoryWindow->UpdateDisplay();
@ -5405,7 +5405,7 @@ void AudacityProject::OnPlotSpectrum()
where.x = 150; where.x = 150;
where.y = 150; where.y = 150;
mFreqWindow = new FreqWindow(this, -1, _("Frequency Analysis"), where); mFreqWindow = safenew FreqWindow(this, -1, _("Frequency Analysis"), where);
} }
mFreqWindow->Show(true); mFreqWindow->Show(true);
@ -5422,7 +5422,7 @@ void AudacityProject::OnContrast()
where.x = 150; where.x = 150;
where.y = 150; where.y = 150;
mContrastDialog = new ContrastDialog(this, -1, _("Contrast Analysis (WCAG 2 compliance)"), where); mContrastDialog = safenew ContrastDialog(this, -1, _("Contrast Analysis (WCAG 2 compliance)"), where);
} }
mContrastDialog->CentreOnParent(); mContrastDialog->CentreOnParent();

View File

@ -547,7 +547,7 @@ bool NoteTrack::Shift(double t) // t is always seconds
int m = ROUND(t * tempo / beats_per_measure); int m = ROUND(t * tempo / beats_per_measure);
// need at least 1 measure, so if we rounded down to zero, fix it // need at least 1 measure, so if we rounded down to zero, fix it
if (m == 0) m = 1; if (m == 0) m = 1;
// compute NEW tempo so that m measures at new tempo take t seconds // compute NEW tempo so that m measures at NEW tempo take t seconds
tempo = beats_per_measure * m / t; // in beats per second tempo = beats_per_measure * m / t; // in beats per second
mSeq->insert_silence(0.0, beats_per_measure * m); mSeq->insert_silence(0.0, beats_per_measure * m);
mSeq->set_tempo(tempo * 60.0 /* bpm */, 0.0, beats_per_measure * m); mSeq->set_tempo(tempo * 60.0 /* bpm */, 0.0, beats_per_measure * m);
@ -704,7 +704,7 @@ Alg_seq *NoteTrack::MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
// beat // beat
double bar = tsp->beat + beats_per_measure * (int(measures) + 1); double bar = tsp->beat + beats_per_measure * (int(measures) + 1);
double bar_offset = bar - beat; double bar_offset = bar - beat;
// insert NEW time signature at bar_offset in new sequence // insert NEW time signature at bar_offset in NEW sequence
// It will have the same time signature, but the position will // It will have the same time signature, but the position will
// force a barline to match the barlines in mSeq // force a barline to match the barlines in mSeq
seq->set_time_sig(bar_offset, tsp->num, tsp->den); seq->set_time_sig(bar_offset, tsp->num, tsp->den);

View File

@ -2033,8 +2033,8 @@ void AudacityProject::OnShow(wxShowEvent & event)
// this is a pure wxWidgets event (no GDK event behind it) and that it // this is a pure wxWidgets event (no GDK event behind it) and that it
// therefore isn't processed within the YieldFor(..) of the clipboard // therefore isn't processed within the YieldFor(..) of the clipboard
// operations (workaround for Debian bug #765341). // operations (workaround for Debian bug #765341).
wxSizeEvent *sizeEvent = new wxSizeEvent(GetSize()); // QueueEvent() will take ownership of the event
GetEventHandler()->QueueEvent(sizeEvent); GetEventHandler()->QueueEvent(safenew wxSizeEvent(GetSize()));
// Further processing by default handlers // Further processing by default handlers
event.Skip(); event.Skip();
@ -5344,7 +5344,7 @@ bool AudacityProject::IsProjectSaved() {
} }
bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) { bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) {
// MY: Will save the project to a new location a-la Save As // MY: Will save the project to a NEW location a-la Save As
// and then tidy up after itself. // and then tidy up after itself.
wxString sNewFileName = fnFile.GetFullPath(); wxString sNewFileName = fnFile.GetFullPath();

View File

@ -551,7 +551,7 @@ public:
// Tags (artist name, song properties, MP3 ID3 info, etc.) // Tags (artist name, song properties, MP3 ID3 info, etc.)
// The structure may be shared with undo history entries // The structure may be shared with undo history entries
// To keep undo working correctly, always replace this with a new duplicate // To keep undo working correctly, always replace this with a NEW duplicate
// BEFORE doing any editing of it! // BEFORE doing any editing of it!
std::shared_ptr<Tags> mTags; std::shared_ptr<Tags> mTags;

View File

@ -2052,7 +2052,7 @@ GuiWaveTrack * ShuttleGui::AddGuiWaveTrack( const wxString & WXUNUSED(Name))
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), GuiWaveTrack); // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), GuiWaveTrack);
GuiWaveTrack * pGuiWaveTrack; GuiWaveTrack * pGuiWaveTrack;
miProp=1; miProp=1;
mpWind = pGuiWaveTrack = new GuiWaveTrack(mpParent, miId, Name); mpWind = pGuiWaveTrack = safenew GuiWaveTrack(mpParent, miId, Name);
mpWind->SetMinSize(wxSize(100,50)); mpWind->SetMinSize(wxSize(100,50));
UpdateSizers(); UpdateSizers();
return pGuiWaveTrack; return pGuiWaveTrack;
@ -2096,7 +2096,7 @@ AttachableScrollBar * ShuttleGui::AddAttachableScrollBar( long style )
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), AttachableScrollBar); // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), AttachableScrollBar);
AttachableScrollBar * pAttachableScrollBar; AttachableScrollBar * pAttachableScrollBar;
miProp=0; miProp=0;
mpWind = pAttachableScrollBar = new AttachableScrollBar( mpWind = pAttachableScrollBar = safenew AttachableScrollBar(
mpParent, mpParent,
miId, miId,
wxDefaultPosition, wxDefaultPosition,

View File

@ -85,7 +85,7 @@ static double wxDateTime_to_AudacityTime(wxDateTime& dateTime)
// By default the msaa state of wxDatePickerCtrl is always normal (0x0), and this causes nvda not // By default the msaa state of wxDatePickerCtrl is always normal (0x0), and this causes nvda not
// to read the control when the user tabs to it. This class // to read the control when the user tabs to it. This class
// modifies the state to be focusable + focused (when it's the focus). // modifies the state to be focusable + focused (when it's the focus).
// Note that even with this class NVDA still doesn't read the new selected part of the control when left/right // Note that even with this class NVDA still doesn't read the NEW selected part of the control when left/right
// arrow keys are used. // arrow keys are used.
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
@ -804,7 +804,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartStatic(_("Start Date and Time"), true); S.StartStatic(_("Start Date and Time"), true);
{ {
m_pDatePickerCtrl_Start = m_pDatePickerCtrl_Start =
new wxDatePickerCtrl(this, // wxWindow *parent, safenew wxDatePickerCtrl(this, // wxWindow *parent,
ID_DATEPICKER_START, // wxWindowID id, ID_DATEPICKER_START, // wxWindowID id,
m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime, m_DateTime_Start); // const wxDateTime& dt = wxDefaultDateTime,
// const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl")
@ -815,7 +815,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
#endif #endif
S.AddWindow(m_pDatePickerCtrl_Start); S.AddWindow(m_pDatePickerCtrl_Start);
m_pTimeTextCtrl_Start = new NumericTextCtrl( m_pTimeTextCtrl_Start = safenew NumericTextCtrl(
NumericConverter::TIME, this, ID_TIMETEXT_START); NumericConverter::TIME, this, ID_TIMETEXT_START);
m_pTimeTextCtrl_Start->SetName(_("Start Time")); m_pTimeTextCtrl_Start->SetName(_("Start Time"));
m_pTimeTextCtrl_Start->SetFormatString(strFormat); m_pTimeTextCtrl_Start->SetFormatString(strFormat);
@ -829,7 +829,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartStatic(_("End Date and Time"), true); S.StartStatic(_("End Date and Time"), true);
{ {
m_pDatePickerCtrl_End = m_pDatePickerCtrl_End =
new wxDatePickerCtrl(this, // wxWindow *parent, safenew wxDatePickerCtrl(this, // wxWindow *parent,
ID_DATEPICKER_END, // wxWindowID id, ID_DATEPICKER_END, // wxWindowID id,
m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime, m_DateTime_End); // const wxDateTime& dt = wxDefaultDateTime,
// const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl") // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, const wxValidator& validator = wxDefaultValidator, const wxString& name = "datectrl")
@ -840,7 +840,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
#endif #endif
S.AddWindow(m_pDatePickerCtrl_End); S.AddWindow(m_pDatePickerCtrl_End);
m_pTimeTextCtrl_End = new NumericTextCtrl( m_pTimeTextCtrl_End = safenew NumericTextCtrl(
NumericConverter::TIME, this, ID_TIMETEXT_END); NumericConverter::TIME, this, ID_TIMETEXT_END);
m_pTimeTextCtrl_End->SetName(_("End Time")); m_pTimeTextCtrl_End->SetName(_("End Time"));
m_pTimeTextCtrl_End->SetFormatString(strFormat); m_pTimeTextCtrl_End->SetFormatString(strFormat);
@ -861,7 +861,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
* seconds. * seconds.
*/ */
wxString strFormat1 = _("099 days 024 h 060 m 060 s"); wxString strFormat1 = _("099 days 024 h 060 m 060 s");
m_pTimeTextCtrl_Duration = new NumericTextCtrl(NumericConverter::TIME, this, ID_TIMETEXT_DURATION); m_pTimeTextCtrl_Duration = safenew NumericTextCtrl(NumericConverter::TIME, this, ID_TIMETEXT_DURATION);
m_pTimeTextCtrl_Duration->SetName(_("Duration")); m_pTimeTextCtrl_Duration->SetName(_("Duration"));
m_pTimeTextCtrl_Duration->SetFormatString(strFormat1); m_pTimeTextCtrl_Duration->SetFormatString(strFormat1);
m_pTimeTextCtrl_Duration->SetValue(m_TimeSpan_Duration.GetSeconds().ToDouble()); m_pTimeTextCtrl_Duration->SetValue(m_TimeSpan_Duration.GetSeconds().ToDouble());

View File

@ -212,10 +212,10 @@ class AUDACITY_DLL_API Track /* not final */ : public XMLTagHandler
// separate from the Track. // separate from the Track.
DirManager* GetDirManager() const { return mDirManager; } DirManager* GetDirManager() const { return mDirManager; }
// Create a new track and modify this track (or return null for failure) // Create a NEW track and modify this track (or return null for failure)
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1)) { return{}; } virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1)) { return{}; }
// Create a new track and don't modify this track (or return null for failure) // Create a NEW track and don't modify this track (or return null for failure)
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1)) const { return{}; } virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1)) const { return{}; }
// Return true for success // Return true for success

View File

@ -146,7 +146,7 @@ is time to refresh some aspect of the screen.
Stereo channel grouping. Stereo channel grouping.
The precise names of the classes are subject to revision. The precise names of the classes are subject to revision.
Have deliberately not created NEW files for the new classes Have deliberately not created NEW files for the NEW classes
such as AdornedRulerPanel and TrackInfo - yet. such as AdornedRulerPanel and TrackInfo - yet.
*//*****************************************************************/ *//*****************************************************************/
@ -549,7 +549,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
mFreqSelMode = FREQ_SEL_INVALID; mFreqSelMode = FREQ_SEL_INVALID;
mFrequencySnapper.reset(new SpectrumAnalyst()); mFrequencySnapper = std::make_unique<SpectrumAnalyst>();
mLastF0 = mLastF1 = SelectedRegion::UndefinedFrequency; mLastF0 = mLastF1 = SelectedRegion::UndefinedFrequency;
#endif #endif
@ -1091,7 +1091,7 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */)
// Drawing now goes directly to the client area. // Drawing now goes directly to the client area.
// DrawOverlays() may need to draw outside the clipped region. // DrawOverlays() may need to draw outside the clipped region.
// (Used to make a new, separate wxClientDC, but that risks flashing // (Used to make a NEW, separate wxClientDC, but that risks flashing
// problems on Mac.) // problems on Mac.)
dc.DestroyClippingRegion(); dc.DestroyClippingRegion();
DrawOverlays(true, &dc); DrawOverlays(true, &dc);

View File

@ -556,8 +556,8 @@ protected:
// (no GDK event behind it) and that it therefore isn't processed // (no GDK event behind it) and that it therefore isn't processed
// within the YieldFor(..) of the clipboard operations (workaround // within the YieldFor(..) of the clipboard operations (workaround
// for Debian bug #765341). // for Debian bug #765341).
wxTimerEvent *event = new wxTimerEvent(*this); // QueueEvent() will take ownership of the event
parent->GetEventHandler()->QueueEvent(event); parent->GetEventHandler()->QueueEvent(safenew wxTimerEvent(*this));
} }
TrackPanel *parent; TrackPanel *parent;
} mTimer; } mTimer;

View File

@ -11,7 +11,7 @@ Paul Licameli
#ifndef __AUDACITY_TRACK_PANEL_CELL__ #ifndef __AUDACITY_TRACK_PANEL_CELL__
#define __AUDACITY_TRACK_PANEL_CELL__ #define __AUDACITY_TRACK_PANEL_CELL__
// Future: TrackPanelCell will be generalized to a new abstract base class of Track // Future: TrackPanelCell will be generalized to a NEW abstract base class of Track
// and of other things. // and of other things.
class Track; class Track;
using TrackPanelCell = Track; using TrackPanelCell = Track;

View File

@ -265,7 +265,7 @@ void UndoManager::PushState(const TrackList * l,
} }
// Assume tags was duplicted before any changes. // Assume tags was duplicted before any changes.
// Just save a new shared_ptr to it. // Just save a NEW shared_ptr to it.
stack.push_back( stack.push_back(
make_movable<UndoStackElem> make_movable<UndoStackElem>
(std::move(tracksCopy), (std::move(tracksCopy),

View File

@ -143,7 +143,7 @@ enum kInterpolations
// Increment whenever EQCurves.xml is updated // Increment whenever EQCurves.xml is updated
#define EQCURVES_VERSION 1 #define EQCURVES_VERSION 1
#define EQCURVES_REVISION 0 #define EQCURVES_REVISION 0
#define UPDATE_ALL 0 // 0 = merge new presets only, 1 = Update all factory presets. #define UPDATE_ALL 0 // 0 = merge NEW presets only, 1 = Update all factory presets.
static const wxString kInterpStrings[kNumInterpolations] = static const wxString kInterpStrings[kNumInterpolations] =
{ {
@ -1370,7 +1370,7 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
bool needUpdate = (eqCurvesCurrentVersion != eqCurvesInstalledVersion); bool needUpdate = (eqCurvesCurrentVersion != eqCurvesInstalledVersion);
// UpdateDefaultCurves allows us to import new factory presets only, // UpdateDefaultCurves allows us to import NEW factory presets only,
// or update all factory preset curves. // or update all factory preset curves.
if (needUpdate) if (needUpdate)
UpdateDefaultCurves( UPDATE_ALL != 0 ); UpdateDefaultCurves( UPDATE_ALL != 0 );
@ -1506,7 +1506,7 @@ void EffectEqualization::UpdateDefaultCurves(bool updateAll /* false */)
} }
} }
else { else {
// Import new factory defaults but retain all user modified curves. // Import NEW factory defaults but retain all user modified curves.
for (int defCurveCount = 0; defCurveCount < numDefaultCurves; defCurveCount++) { for (int defCurveCount = 0; defCurveCount < numDefaultCurves; defCurveCount++) {
bool isUserCurve = false; bool isUserCurve = false;
// Add if the curve is in the user's set (preserve user's copy) // Add if the curve is in the user's set (preserve user's copy)

View File

@ -143,7 +143,7 @@ private:
void LoadCurves(const wxString &fileName = wxEmptyString, bool append = false); void LoadCurves(const wxString &fileName = wxEmptyString, bool append = false);
void SaveCurves(const wxString &fileName = wxEmptyString); void SaveCurves(const wxString &fileName = wxEmptyString);
// Merge new curves only or update all factory presets. // Merge NEW curves only or update all factory presets.
void UpdateDefaultCurves( bool updateAll = false); void UpdateDefaultCurves( bool updateAll = false);
void Select(int sel); void Select(int sel);
void setCurve(int currentCurve); void setCurve(int currentCurve);

View File

@ -758,7 +758,7 @@ AButton * ToolBar::MakeButton(wxWindow *parent,
wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff)); wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff));
AButton * button = AButton * button =
new AButton(parent, id, placement, size, *up2, *hilite2, *down2, safenew AButton(parent, id, placement, size, *up2, *hilite2, *down2,
*disable2, processdownevents); *disable2, processdownevents);
return button; return button;

View File

@ -139,7 +139,7 @@ void ToolBarConfiguration::Insert(ToolBar *bar, Position position)
// Adopt the child only if the insertion point specifies that // Adopt the child only if the insertion point specifies that
if (adopt && position.adopt) { if (adopt && position.adopt) {
// Make new node with one child // Make NEW node with one child
Tree tree; Tree tree;
tree.pBar = bar; tree.pBar = bar;
tree.children.push_back(Tree{}); tree.children.push_back(Tree{});
@ -580,7 +580,7 @@ void ToolDock::VisitLayout(LayoutVisitor &visitor,
} }
if (visitor.ShouldVisitSpaces()) { if (visitor.ShouldVisitSpaces()) {
// Visit the fringe where new leaves of the tree could go // Visit the fringe where NEW leaves of the tree could go
// Find the items with leftover spaces // Find the items with leftover spaces
const auto end = std::remove_if(layout, layout + ToolBarCount, const auto end = std::remove_if(layout, layout + ToolBarCount,
@ -622,7 +622,7 @@ void ToolDock::VisitLayout(LayoutVisitor &visitor,
} }
// Report the final bounding box of all the bars, and a position where // Report the final bounding box of all the bars, and a position where
// you can insert a new bar at bottom left. // you can insert a NEW bar at bottom left.
ToolBarConfiguration::Position finalPosition { nullptr, lastRoot }; ToolBarConfiguration::Position finalPosition { nullptr, lastRoot };
visitor.FinalRect( visitor.FinalRect(
wxRect { toolbarGap, toolbarGap, main.width, main.y }, finalPosition wxRect { toolbarGap, toolbarGap, main.width, main.y }, finalPosition

View File

@ -1085,6 +1085,7 @@ void ToolManager::OnMouse( wxMouseEvent & event )
// Done with the floater // Done with the floater
mDragWindow->Destroy(); mDragWindow->Destroy();
mDragWindow = nullptr;
mDragBar->Refresh(false); mDragBar->Refresh(false);
} }
else else
@ -1335,7 +1336,7 @@ void ToolManager::OnGrabber( GrabberEvent & event )
mDragBar->SetPositioned(); mDragBar->SetPositioned();
// Construct a NEW floater // Construct a NEW floater
mDragWindow = new ToolFrame( mParent, this, mDragBar, mp ); mDragWindow = safenew ToolFrame( mParent, this, mDragBar, mp );
// Make sure the ferry is visible // Make sure the ferry is visible
mDragWindow->Show(); mDragWindow->Show();
@ -1377,6 +1378,7 @@ void ToolManager::HandleEscapeKey()
// Done with the floater // Done with the floater
mDragWindow->ClearBar(); mDragWindow->ClearBar();
mDragWindow->Destroy(); mDragWindow->Destroy();
mDragWindow = nullptr;
mDragBar->Refresh(false); mDragBar->Refresh(false);
} }
else { else {

View File

@ -292,7 +292,7 @@ void AButton::SetAlternateIdx(unsigned idx)
void AButton::FollowModifierKeys() void AButton::FollowModifierKeys()
{ {
if(!mListener) if(!mListener)
mListener.reset(new Listener(this)); mListener = std::make_unique<Listener>(this);
} }
void AButton::SetFocusRect(wxRect & r) void AButton::SetFocusRect(wxRect & r)

View File

@ -514,7 +514,6 @@ void LWSlider::Init(wxWindow * parent,
AdjustSize(size); AdjustSize(size);
mpRuler = NULL; // Do this and Move() before Draw().
Move(pos); Move(pos);
} }
@ -705,7 +704,8 @@ void LWSlider::Draw(wxDC & paintDC)
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
// Now create and set the mask // Now create and set the mask
mThumbBitmap->SetMask(new wxMask(*mThumbBitmap, transparentColour)); // SetMask takes ownership
mThumbBitmap->SetMask(safenew wxMask(*mThumbBitmap, transparentColour));
#endif #endif
// //
@ -810,7 +810,7 @@ void LWSlider::Draw(wxDC & paintDC)
//{ //{
// if (!mpRuler) // if (!mpRuler)
// { // {
// mpRuler = new Ruler(); // mpRuler = std::make_unique<Ruler>();
// mpRuler->mbTicksOnly = false; // mpRuler->mbTicksOnly = false;
// mpRuler->mbTicksAtExtremes = true; // mpRuler->mbTicksAtExtremes = true;
@ -884,7 +884,8 @@ void LWSlider::Draw(wxDC & paintDC)
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
mBitmap->SetMask(new wxMask(*mBitmap, transparentColour)); // SetMask takes ownership
mBitmap->SetMask(safenew wxMask(*mBitmap, transparentColour));
#endif #endif
} }

View File

@ -231,8 +231,6 @@ class LWSlider
std::unique_ptr<TipPanel> mTipPanel; std::unique_ptr<TipPanel> mTipPanel;
wxString mTipTemplate; wxString mTipTemplate;
std::unique_ptr<Ruler> mpRuler;
bool mIsDragging; bool mIsDragging;
std::unique_ptr<wxBitmap> mBitmap, mThumbBitmap; std::unique_ptr<wxBitmap> mBitmap, mThumbBitmap;

View File

@ -184,11 +184,13 @@ void ShowModelessErrorDialog(wxWindow *parent,
const wxString &helpURL, const wxString &helpURL,
const bool Close) const bool Close)
{ {
ErrorDialog *dlog = new ErrorDialog(parent, dlogTitle, message, helpURL, Close, false); ErrorDialog *dlog = safenew ErrorDialog(parent, dlogTitle, message, helpURL, Close, false);
dlog->CentreOnParent(); dlog->CentreOnParent();
dlog->Show(); dlog->Show();
// ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak.
// ANSWER-ME: This is unused. Delete it or are there plans for it? // ANSWER-ME: This is unused. Delete it or are there plans for it?
// PRL: answer is that the parent window guarantees destruction of the dialog
// but in practice Destroy() in OnOK does that
} }
void ShowAliasMissingDialog(AudacityProject *parent, void ShowAliasMissingDialog(AudacityProject *parent,
@ -197,7 +199,7 @@ void ShowAliasMissingDialog(AudacityProject *parent,
const wxString &helpURL, const wxString &helpURL,
const bool Close) const bool Close)
{ {
ErrorDialog *dlog = new AliasedFileMissingDialog(parent, dlogTitle, message, helpURL, Close, false); ErrorDialog *dlog = safenew AliasedFileMissingDialog(parent, dlogTitle, message, helpURL, Close, false);
// Don't center because in many cases (effect, export, etc) there will be a progress bar in the center that blocks this. // Don't center because in many cases (effect, export, etc) there will be a progress bar in the center that blocks this.
// instead put it just above or on the top of the project. // instead put it just above or on the top of the project.
wxPoint point; wxPoint point;
@ -214,4 +216,6 @@ void ShowAliasMissingDialog(AudacityProject *parent,
// stop playback AND read dialog's instructions. // stop playback AND read dialog's instructions.
dlog->Show(); dlog->Show();
// ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak.
// PRL: answer is that the parent window guarantees destruction of the dialog
// but in practice Destroy() in OnOK does that
} }

View File

@ -152,7 +152,7 @@ ExpandingToolBar::ExpandingToolBar(wxWindow* parent,
wxColour magicColor = wxColour(0, 255, 255); wxColour magicColor = wxColour(0, 255, 255);
ImageArray fourStates = ImageRoll::SplitV(hbar, magicColor); ImageArray fourStates = ImageRoll::SplitV(hbar, magicColor);
mToggleButton = new AButton(this, kToggleButtonID, mToggleButton = safenew AButton(this, kToggleButtonID,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
ImageRoll(ImageRoll::HorizontalRoll, ImageRoll(ImageRoll::HorizontalRoll,
fourStates[0], magicColor), fourStates[0], magicColor),

View File

@ -2223,7 +2223,7 @@ void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
// Stroke extras direct to the client area, // Stroke extras direct to the client area,
// maybe outside of the damaged area // maybe outside of the damaged area
// As with TrackPanel, do not make a new wxClientDC or else Mac flashes badly! // As with TrackPanel, do not make a NEW wxClientDC or else Mac flashes badly!
dc.DestroyClippingRegion(); dc.DestroyClippingRegion();
DrawOverlays(true, &dc); DrawOverlays(true, &dc);
} }