1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 23:02:42 +02:00

Bug 2176 - Crash when attempting to time shift multiple tracks

Steps to reproduce:
1. create a new project in Audacity
2. add several tracks.
3. turn on Sync-Lock (Tracks, Sync-Lock Tracks checked)
4. Click on the Time Shift Tool.
5. Attempt to move tracks to the right (for example), clicking in the bottom track
6. It crashes.

In the function: void TimeShiftHandle::CreateListOfCapturedClips(), the problem was the first occurrence of the line:
auto &trackClip = state.capturedClipArray[i];
The subsequent call to AddClipsToCaptured(), can reallocate the array and so invalidate the reference.

Fix: Don't use a reference. (TrackClip is not a large object.)
This commit is contained in:
David Bailes 2019-07-27 13:16:15 +01:00
parent 960fe47412
commit ee46155d82

View File

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