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

Bug 2803 - Audacity unresponsive after 'Fit to Height'

a) Fixed root cause, which is conversion of a
negative integer to a large unsigned, leading to
a very tall track.
b) Improved mitigation (in projects that already
have over tall tracks) by setting a smaller minimum
for the allowed size.
This commit is contained in:
James Crook
2021-06-08 22:05:56 +01:00
parent 1b9e938869
commit 404ad6ad8a
2 changed files with 8 additions and 3 deletions

View File

@@ -145,7 +145,12 @@ void DoZoomFitV(AudacityProject &project)
- range.sum( TrackView::GetTrackHeight );
// Give each resized track the average of the remaining height
height = height / count;
// Bug 2803: Cast count to int, because otherwise the result of
// division will be unsigned too, and will be a very large number
// if height was negative!
height = height / (int)count;
// Use max() so that we don't set a negative height when there is
// not enough room.
height = std::max( (int)TrackInfo::MinimumTrackHeight(), height );
for (auto t : range)