From 89d88cc7ba7ddcd19237affa0d79d4c66f235bee Mon Sep 17 00:00:00 2001 From: mchinen Date: Sun, 17 Apr 2011 00:58:00 +0000 Subject: [PATCH] Bug 367 (P2) - fix crash when sliding tracks vertically using sync lock. --- src/TrackPanel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index ef661ef77..771cce682 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -7572,13 +7572,20 @@ bool TrackPanel::MoveClipToTrack(WaveClip *clip, if (src2) src2->MoveClipToTrack(clip2, dst2); + // If sync-lock is on then one of the mCapturedClipArray indexes may be a labeltrack. + // This means that we are not really copying a stereo track and cannot assume dst2 exists. + // If we found a src2 is the best indicator of whether or not it is stereo. + // This assumes that the first captured tracks will be WaveTracks - I believe this is the case + // from whats generated in StartSlide() if (mCapturedClipArray.GetCount() == 2) { if (mCapturedClipArray[0].clip == clip) { mCapturedClipArray[0].track = dst; - mCapturedClipArray[1].track = dst2; + if (src2) + mCapturedClipArray[1].track = dst2; } else { - mCapturedClipArray[0].track = dst2; + if (src2) + mCapturedClipArray[0].track = dst2; mCapturedClipArray[1].track = dst; } }