mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 08:39:46 +02:00
Bug2015: crash repeatedly append-recording with sync-lock on
This commit is contained in:
parent
911840074e
commit
3be57fce49
@ -325,13 +325,19 @@ bool Track::IsSyncLockSelected() const
|
||||
auto pList = mList.lock();
|
||||
if (!pList)
|
||||
return false;
|
||||
auto trackRange = TrackList::SyncLockGroup(this);
|
||||
|
||||
auto shTrack = this->SubstituteOriginalTrack();
|
||||
if (!shTrack)
|
||||
return false;
|
||||
|
||||
const auto pTrack = shTrack.get();
|
||||
auto trackRange = TrackList::SyncLockGroup( pTrack );
|
||||
|
||||
if (trackRange.size() <= 1) {
|
||||
// Not in a sync-locked group.
|
||||
// Return true iff selected and of a sync-lockable type.
|
||||
return (IsSyncLockableNonLabelTrack(this) ||
|
||||
track_cast<const LabelTrack*>(this)) && GetSelected();
|
||||
return (IsSyncLockableNonLabelTrack( pTrack ) ||
|
||||
track_cast<const LabelTrack*>( pTrack )) && GetSelected();
|
||||
}
|
||||
|
||||
// Return true iff any track in the group is selected.
|
||||
@ -1377,6 +1383,26 @@ std::shared_ptr<const Track> Track::SubstitutePendingChangedTrack() const
|
||||
return Pointer( this );
|
||||
}
|
||||
|
||||
std::shared_ptr<const Track> Track::SubstituteOriginalTrack() const
|
||||
{
|
||||
auto pList = mList.lock();
|
||||
if (pList) {
|
||||
const auto id = GetId();
|
||||
const auto pred = [=]( const ListOfTracks::value_type &ptr ) {
|
||||
return ptr->GetId() == id; };
|
||||
const auto end = pList->mPendingUpdates.end();
|
||||
const auto it = std::find_if( pList->mPendingUpdates.begin(), end, pred );
|
||||
if (it != end) {
|
||||
const auto &list2 = (const ListOfTracks &) *pList;
|
||||
const auto end2 = list2.end();
|
||||
const auto it2 = std::find_if( list2.begin(), end2, pred );
|
||||
if ( it2 != end2 )
|
||||
return *it2;
|
||||
}
|
||||
}
|
||||
return Pointer( this );
|
||||
}
|
||||
|
||||
bool TrackList::HasPendingTracks() const
|
||||
{
|
||||
if ( !mPendingUpdates.empty() )
|
||||
|
@ -257,6 +257,10 @@ class AUDACITY_DLL_API Track /* not final */
|
||||
// not yet cleared or applied; if no such exists, return this track
|
||||
std::shared_ptr<const Track> SubstitutePendingChangedTrack() const;
|
||||
|
||||
// If this track is a pending changed track, return the corresponding
|
||||
// original; else return this track
|
||||
std::shared_ptr<const Track> SubstituteOriginalTrack() const;
|
||||
|
||||
// Cause certain overriding tool modes (Zoom; future ones?) to behave
|
||||
// uniformly in all tracks, disregarding track contents.
|
||||
// Do not further override this...
|
||||
|
Loading…
x
Reference in New Issue
Block a user