lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check for Note_column interface before using grob. (issue 141190043 by a


From: eble
Subject: Check for Note_column interface before using grob. (issue 141190043 by address@hidden)
Date: Sat, 06 Sep 2014 18:58:10 +0000

Reviewers: ,

Description:
Check for Note_column interface before using grob.

Rest_collision was calling Note_column functions on grobs that did not
have the Note_column interface.  Now Rest_collision ignores such grobs
and Note_column will print a more accurate message if such an error
ever happens again.

Reported in
http://article.gmane.org/gmane.comp/gnu.lilypond.bugs/39758 .

Please review this at https://codereview.appspot.com/141190043/

Affected files (+11, -5 lines):
  M lily/note-column.cc
  M lily/rest-collision.cc


Index: lily/note-column.cc
diff --git a/lily/note-column.cc b/lily/note-column.cc
index 760e37dc1956c045d51d3250bee9fad5269ee73b..2a884d3f666a03991c78b2e7141a80ff0694b3cc 100644
--- a/lily/note-column.cc
+++ b/lily/note-column.cc
@@ -107,7 +107,10 @@ Note_column::dir (Grob *me)
         return (Direction)sign (head_positions_interval (me).center ());
     }

-  programming_error ("note column without heads and stem");
+  if (has_interface(me))
+    programming_error ("Note_column without heads and stem");
+  else
+    programming_error ("dir() given grob without Note_column interface");
   return CENTER;
 }

Index: lily/rest-collision.cc
diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc
index 743f14ad79a2e9b0ef0c6ecdc364240419a1d1dd..606016f7a78e552806cc7308d451bf9a49800b10 100644
--- a/lily/rest-collision.cc
+++ b/lily/rest-collision.cc
@@ -108,10 +108,13 @@ Rest_collision::calc_positioning_done (SCM smob)
   for (vsize i = 0; i < elts.size (); i++)
     {
       Grob *e = elts[i];
-      if (Grob::unsmob (e->get_object ("rest")))
-        rests.push_back (e);
-      else
-        notes.push_back (e);
+      if (Note_column::has_interface(e))
+        {
+          if (Grob::unsmob (e->get_object ("rest")))
+            rests.push_back (e);
+          else
+            notes.push_back (e);
+        }
     }

   /*





reply via email to

[Prev in Thread] Current Thread [Next in Thread]