]> git.donarmstrong.com Git - lilypond.git/commitdiff
slur-scoring: avoid infinite loop with empty note columns; issue 2831
authorKeith OHara <k-ohara5a5a@oco.net>
Sat, 15 Sep 2012 23:18:41 +0000 (16:18 -0700)
committerKeith OHara <k-ohara5a5a@oco.net>
Fri, 28 Sep 2012 05:50:45 +0000 (22:50 -0700)
lily/slur-scoring.cc
lily/stem.cc

index e1025fa545c56c1c20ee0a476355b778229cf336..47bb40611c483018713bae43ec380b3ed1cd9461 100644 (file)
@@ -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_;
index 7037b8869cdb2c59f9e4a356e5de3622bee704c1..4d5b7746b59fcfc1e8292741b335c7fd46b4a470 100644 (file)
@@ -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;