mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-25 15:53:52 +02:00
Correct TrackList::Swap -- mind the back-pointers in the tracks.
This commit is contained in:
@@ -754,6 +754,22 @@ void TrackList::Swap(TrackList &that)
|
||||
std::swap(mDestructorDeletesTracks, that.mDestructorDeletesTracks);
|
||||
std::swap(head, that.head);
|
||||
std::swap(tail, that.tail);
|
||||
|
||||
{
|
||||
TrackListIterator iter(this);
|
||||
for (Track *t = iter.First(); t; t = iter.Next()) {
|
||||
t->SetOwner(NULL, NULL);
|
||||
t->SetOwner(this, iter.cur);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
TrackListIterator iter(&that);
|
||||
for (Track *t = iter.First(); t; t = iter.Next()) {
|
||||
t->SetOwner(NULL, NULL);
|
||||
t->SetOwner(&that, iter.cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TrackList::~TrackList()
|
||||
|
||||
Reference in New Issue
Block a user