temporal: fix ::get_grid() crash condition

We cannot call TempoMetric::superclock_at (BBT_Time) if the BBT time is beyond
the range of the current TempoMetric. We must discover that *before* we make
that call, not as part of the test to see if we've exceeded the range.
This commit is contained in:
Paul Davis 2022-12-10 22:59:58 -07:00
parent 5e9e21911c
commit 39c324b620

View file

@ -2090,13 +2090,24 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
}
}
start = metric.superclock_at (bbt);
DEBUG_TRACE (DEBUG::Grid, string_compose ("pre-check overrun of next point with bbt @ %1 audio %2 point %3\n", bbt, start, *p));
DEBUG_TRACE (DEBUG::Grid, string_compose ("check overrun of next point with bbt @ %1 audio %2 point %3\n", bbt, start, *p));
bool reset = false;
if ((!next_point_is_bbt_marker && bbt >= p->bbt()) || (start >= p->sclock())) {
if (!next_point_is_bbt_marker && bbt >= p->bbt()) {
DEBUG_TRACE (DEBUG::Grid, string_compose ("we've reached/passed the next point via BBT, BBT %1 audio %2 point %3\n", bbt, start, *p));
reset = true;
} else {
start = metric.superclock_at (bbt);
if (start >= p->sclock()) {
DEBUG_TRACE (DEBUG::Grid, string_compose ("we've reached/passed the next point via sclock, BBT %1 audio %2 point %3\n", bbt, start, *p));
reset = true;
}
}
DEBUG_TRACE (DEBUG::Grid, string_compose ("we've reached/passed the next point, BBT %1 audio %2 point %3\n", bbt, start, *p));
DEBUG_TRACE (DEBUG::Grid, string_compose ("check overrun of next point, reset required ? %4 with bbt @ %1 audio %2 point %3\n", bbt, start, *p, (reset ? "YES" : "NO")));
if (reset) {
/* reset our sense of "now" to be wherever the point is */