From 1b9e938869fc9c797e3759cb58ea043d3091ba56 Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 8 Jun 2021 19:29:55 +0100 Subject: [PATCH] Fix / workaround for bad track heights. The root cause of the bad track height hasn't been tracked down yet. It may be related to collapsing tracks as it was first seen with all tracks collapsed. --- src/tracks/ui/TrackView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tracks/ui/TrackView.cpp b/src/tracks/ui/TrackView.cpp index 4f37693ef..c8df8ef4e 100644 --- a/src/tracks/ui/TrackView.cpp +++ b/src/tracks/ui/TrackView.cpp @@ -97,6 +97,10 @@ bool TrackView::HandleXMLAttribute( const wxChar *attr, const wxChar *value ) long nValue; if (!wxStrcmp(attr, wxT("height")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { + // Extreme values for track height (likely caused by integer overflow) + // will stall Audacity as it tries to create an enormous vertical ruler. + // So clamp to reasonable values. + nValue = std::max( 150l, std::min( nValue, 1000l )); SetHeight(nValue); return true; }