1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-29 08:43:56 +01:00

Use weak_ptr to remember focused track, don't ask for trouble

This commit is contained in:
Paul Licameli
2017-06-24 14:02:35 -04:00
parent bd5d2bf114
commit 321919301e
3 changed files with 58 additions and 55 deletions

View File

@@ -1000,10 +1000,9 @@ void TrackPanel::OnTrackListDeletion(wxCommandEvent & e)
if (mUIHandle)
mUIHandle->OnProjectChange(GetProject());
// Tracks may have been deleted, so check to see if the focused track was on of them.
if (!mTracks->Contains(GetFocusedTrack())) {
SetFocusedTrack(NULL);
}
// If the focused track disappeared but there are still other tracks,
// this reassigns focus.
GetFocusedTrack();
UpdateVRulerSize();
@@ -2573,7 +2572,7 @@ void TrackPanel::DisplaySelection()
Track *TrackPanel::GetFocusedTrack()
{
return mAx->GetFocus();
return mAx->GetFocus().get();
}
void TrackPanel::SetFocusedTrack( Track *t )
@@ -2590,7 +2589,7 @@ void TrackPanel::SetFocusedTrack( Track *t )
AudacityProject::CaptureKeyboard(this);
}
mAx->SetFocus( t );
mAx->SetFocus( Track::Pointer( t ) );
Refresh( false );
}