1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-12 06:01:13 +02:00

Fix some crashes in time-shift

This commit is contained in:
Paul Licameli 2018-10-04 12:02:51 -04:00
parent 92cceaf599
commit b5a7b67cb7

View File

@ -263,25 +263,31 @@ void TimeShiftHandle::CreateListOfCapturedClips
// because AddClipsToCaptured doesn't add duplicate clips); to remove // because AddClipsToCaptured doesn't add duplicate clips); to remove
// this behavior just store the array size beforehand. // this behavior just store the array size beforehand.
for (unsigned int i = 0; i < state.capturedClipArray.size(); ++i) { for (unsigned int i = 0; i < state.capturedClipArray.size(); ++i) {
auto &trackClip = state.capturedClipArray[i]; {
// Capture based on tracks that have clips -- that means we auto &trackClip = state.capturedClipArray[i];
// don't capture based on links to label tracks for now (until // Capture based on tracks that have clips -- that means we
// we can treat individual labels as clips) // don't capture based on links to label tracks for now (until
if ( trackClip.clip ) { // we can treat individual labels as clips)
// Iterate over sync-lock group tracks. if ( trackClip.clip ) {
for (auto t : TrackList::SyncLockGroup( trackClip.track )) // Iterate over sync-lock group tracks.
AddClipsToCaptured(state, t, for (auto t : TrackList::SyncLockGroup( trackClip.track ))
trackClip.clip->GetStartTime(), AddClipsToCaptured(state, t,
trackClip.clip->GetEndTime() ); trackClip.clip->GetStartTime(),
trackClip.clip->GetEndTime() );
}
} }
#ifdef USE_MIDI #ifdef USE_MIDI
// Capture additional clips from NoteTracks {
trackClip.track->TypeSwitch( [&](NoteTrack *nt) { // Beware relocation of array contents! Bind trackClip again.
// Iterate over sync-lock group tracks. auto &trackClip = state.capturedClipArray[i];
for (auto t : TrackList::SyncLockGroup(nt)) // Capture additional clips from NoteTracks
AddClipsToCaptured trackClip.track->TypeSwitch( [&](NoteTrack *nt) {
( state, t, nt->GetStartTime(), nt->GetEndTime() ); // Iterate over sync-lock group tracks.
}); for (auto t : TrackList::SyncLockGroup(nt))
AddClipsToCaptured
( state, t, nt->GetStartTime(), nt->GetEndTime() );
});
}
#endif #endif
} }
} }