From d10557fc8c3be1e225ff583af9cb5cbc60ebc2a4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 4 Aug 2022 09:50:39 -0600 Subject: [PATCH] fix exception when loading a region whose length exceeds its source and the time domains do not match See code comment for more info --- libs/ardour/region.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index d61a227f2c..a7a4d54859 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1346,7 +1346,14 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang */ if (!_sources.empty() && _type == DataType::AUDIO) { - if ((length().time_domain() == Temporal::AudioTime) && (length().distance() > _sources.front()->length())) { + /* both region and source length must be audio time for this to + actually be a case of a destructive track/region. And also + for the operator>() in the 3rd conditional clause to be + legal, since these values are timepos_t IS-A int62_t and + that requires the same "flagged" status (i.e. domain) to be + match. + */ + if ((length().time_domain() == Temporal::AudioTime) && (_sources.front()->length().time_domain() == Temporal::AudioTime) && (length().distance() > _sources.front()->length())) { _length = timecnt_t (start().distance (_sources.front()->length()), _length.val().position()); } }