mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-29 16:27:03 +01:00
More precautions about the back-pointers of tracks to their lists
This commit is contained in:
@@ -993,6 +993,11 @@ TrackNodePointer TrackList::Remove(Track *t)
|
|||||||
|
|
||||||
void TrackList::Clear(bool sendEvent)
|
void TrackList::Clear(bool sendEvent)
|
||||||
{
|
{
|
||||||
|
// Null out the back-pointers in tracks, in case there are outstanding
|
||||||
|
// shared_ptrs to those tracks.
|
||||||
|
for ( auto pTrack: *this )
|
||||||
|
pTrack->SetOwner( {}, {} );
|
||||||
|
|
||||||
ListOfTracks tempList;
|
ListOfTracks tempList;
|
||||||
tempList.swap( *this );
|
tempList.swap( *this );
|
||||||
if (sendEvent)
|
if (sendEvent)
|
||||||
|
|||||||
Reference in New Issue
Block a user