fixed timeline crash

This commit is contained in:
itsmattkc
2021-10-25 14:54:48 -07:00
parent 4ed9ba5475
commit 6543512d00
2 changed files with 11 additions and 4 deletions
+4
View File
@@ -325,6 +325,10 @@ Block *Track::NearestBlockBefore(const rational &time) const
{
foreach (Block* block, blocks_) {
// Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block
if (block->in() == time) {
break;
}
if (block->out() >= time) {
return block;
}
+7 -4
View File
@@ -1368,7 +1368,7 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
QVector<Timeline::EditToInfo> info_list(tracks.size());
for (int i=0;i<tracks.size();i++) {
Timeline::EditToInfo info;
Timeline::EditToInfo &info = info_list[i];
Track* track = tracks.at(i);
info.track = track;
@@ -1397,8 +1397,6 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
}
info.nearest_block = b;
info_list[i] = info;
}
return info_list;
@@ -1415,7 +1413,7 @@ void TimelineWidget::RippleTo(Timeline::MovementMode mode)
}
// Find each track's nearest point and determine the overall timeline's nearest point
rational closest_point_to_playhead = (mode == Timeline::kTrimIn) ? 0 : RATIONAL_MAX;
rational closest_point_to_playhead = (mode == Timeline::kTrimIn) ? RATIONAL_MIN : RATIONAL_MAX;
foreach (const Timeline::EditToInfo& info, tracks) {
if (info.nearest_block) {
@@ -1427,6 +1425,11 @@ void TimelineWidget::RippleTo(Timeline::MovementMode mode)
}
}
if (closest_point_to_playhead == RATIONAL_MIN || closest_point_to_playhead == RATIONAL_MAX) {
// Assume no blocks will be acted upon
return;
}
// If we're not inserting gaps and the edit point is right on the nearest in point, we enter a
// single-frame mode where we remove one frame only
if (closest_point_to_playhead == playhead_time) {