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.
This commit is contained in:
James Crook 2021-06-08 19:29:55 +01:00
parent 97914403f6
commit 1b9e938869
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}