1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-11 15:16:27 +01:00

BHug1488: Don't crash exiting from command-line benchmark test...

Problem was that cfd7648fce fixed a memory leak
but created a dangling pointer bug, which does not happen during usual run
of Audacity because AudacityProject::OnCloseWindow is reached then before
destroying AudacityProject.

Fixed it by using a std::shared_pointer for the TrackList that both
AudacityProject and TrackPanel must use.
This commit is contained in:
Paul Licameli
2016-08-20 13:58:56 -04:00
parent 05fe684114
commit 5761972dfa
5 changed files with 42 additions and 42 deletions

View File

@@ -138,7 +138,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel {
wxWindowID id,
const wxPoint & pos,
const wxSize & size,
TrackList * tracks,
const std::shared_ptr<TrackList> &tracks,
ViewInfo * viewInfo,
TrackPanelListener * listener,
AdornedRulerPanel * ruler );
@@ -487,7 +487,7 @@ protected:
// JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel
// They work around some messy problems with constructors.
public:
TrackList * GetTracks(){ return mTracks;}
TrackList * GetTracks(){ return mTracks.get(); }
ViewInfo * GetViewInfo(){ return mViewInfo;}
TrackPanelListener * GetListener(){ return mListener;}
AdornedRulerPanel * GetRuler(){ return mRuler;}
@@ -497,7 +497,7 @@ public:
wxWindowID id,
const wxPoint & pos,
const wxSize & size,
TrackList * tracks,
const std::shared_ptr<TrackList> &tracks,
ViewInfo * viewInfo,
TrackPanelListener * listener,
AdornedRulerPanel * ruler);
@@ -539,7 +539,7 @@ protected:
protected:
TrackPanelListener *mListener;
TrackList *mTracks;
std::shared_ptr<TrackList> mTracks;
ViewInfo *mViewInfo;
AdornedRulerPanel *mRuler;