mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Remove some naked new amd delete in: TrackPanel::mAx
This commit is contained in:
parent
20bee00115
commit
3b6dcfcc32
@ -441,10 +441,16 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
SetName(_("Track Panel"));
|
SetName(_("Track Panel"));
|
||||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
mAx = new TrackPanelAx( this );
|
{
|
||||||
|
auto pAx = std::make_unique <TrackPanelAx>( this );
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
SetAccessible( mAx );
|
// wxWidgets owns the accessible object
|
||||||
|
SetAccessible(mAx = pAx.release());
|
||||||
|
#else
|
||||||
|
// wxWidgets doesn not own the object, but we need to retain it
|
||||||
|
mAx = std::move(pAx);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
mMouseCapture = IsUncaptured;
|
mMouseCapture = IsUncaptured;
|
||||||
mSlideUpDownOnly = false;
|
mSlideUpDownOnly = false;
|
||||||
@ -577,10 +583,6 @@ TrackPanel::~TrackPanel()
|
|||||||
delete mSnapManager;
|
delete mSnapManager;
|
||||||
|
|
||||||
DeleteMenus();
|
DeleteMenus();
|
||||||
|
|
||||||
#if !wxUSE_ACCESSIBILITY
|
|
||||||
delete mAx;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackPanel::BuildMenusIfNeeded(void)
|
void TrackPanel::BuildMenusIfNeeded(void)
|
||||||
|
@ -786,7 +786,11 @@ protected:
|
|||||||
|
|
||||||
friend class TrackPanelAx;
|
friend class TrackPanelAx;
|
||||||
|
|
||||||
TrackPanelAx *mAx;
|
#if wxUSE_ACCESSIBILITY
|
||||||
|
TrackPanelAx *mAx{};
|
||||||
|
#else
|
||||||
|
std::unique_ptr<TrackPanelAx> mAx;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TrackPanelAx &GetAx() { return *mAx; }
|
TrackPanelAx &GetAx() { return *mAx; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user