From d5d79d9d580e584c9ffec584784e8fee00f0b62c Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Sat, 15 Sep 2012 16:18:41 -0700 Subject: [PATCH] slur-scoring: avoid infinite loop with empty note columns; issue 2831 --- lily/slur-scoring.cc | 15 ++++++++++----- lily/stem.cc | 12 ++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index e1025fa545..47bb40611c 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -459,11 +459,16 @@ Slur_score_state::get_y_attachment_range () const { if (extremes_[d].note_column_) { - end_ys[d] = dir_ - * max (max (dir_ * (base_attachments_[d][Y_AXIS] - + parameters_.region_size_ * dir_), - dir_ * (dir_ + extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS)[dir_])), - dir_ * base_attachments_[-d][Y_AXIS]); + Interval nc_extent = extremes_[d].note_column_ + ->extent (common_[Y_AXIS], Y_AXIS); + if (nc_extent.is_empty ()) + slur_->warning ("slur trying to encompass an empty note column."); + else + end_ys[d] = dir_ + * max (max (dir_ * (base_attachments_[d][Y_AXIS] + + parameters_.region_size_ * dir_), + dir_ * (dir_ + nc_extent[dir_])), + dir_ * base_attachments_[-d][Y_AXIS]); } else end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * dir_; diff --git a/lily/stem.cc b/lily/stem.cc index 7037b8869c..4d5b7746b5 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -275,9 +275,12 @@ Stem::add_head (Grob *me, Grob *n) bool Stem::is_invisible (Grob *me) { - return !is_normal_stem (me) - && (robust_scm2double (me->get_property ("stemlet-length"), - 0.0) == 0.0); + if (is_normal_stem (me)) + return false; + else if (head_count (me)) + return true; + else // if there are no note-heads, we might want stemlets + return 0.0 == robust_scm2double (me->get_property ("stemlet-length"), 0.0); } bool @@ -813,9 +816,6 @@ Stem::is_valid_stem (Grob *me) if (!lh && !beam) return false; - if (lh && robust_scm2int (lh->get_property ("duration-log"), 0) < 1) - return false; - if (is_invisible (me)) return false; -- 2.39.2