lilypond-devel
[Top][All Lists]
Advanced

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

Re: Issue 3205: opening bar check causes crash if \score contains the \m


From: dak
Subject: Re: Issue 3205: opening bar check causes crash if \score contains the \midi block (issue 7377057)
Date: Wed, 27 Feb 2013 08:28:51 +0000

Reviewers: Keith,

Message:
On 2013/02/27 07:07:58, Keith wrote:
I tried skipTypesetting and showFirstLength in different situations.
They seem
to work.

It would be nice to know at least /how/ this change causes
Score_performer::prepare() to be called.

On the other hand, it seems that the bar-check-iterator should not
have caused
Score_performer::one_time_step() to be called at all.

It is not the bar-check-iterator that calls one_time_step as you can see
by leaving off the note.  But the bar-check-iterator causes
Score_performer::prepare to be missed.

The code in score-performer.cc (as well as score-engraver.cc except that
the latter does not mind missing prepare all that much) registers
listeners for Prepare and OneTimeStep _when_ the Score context is
created.

A mere \context Score { | d } is already enough to prevent the segfault.
 But if you start right with | without a score context, Prepare and
OneTimeStep only get registered once d turns up, and it would appear
that the Prepare event has gone by that time and is no longer seen by
the listener.

I have no clue what makes the standard Music_iterator different here.
The only other use of Simple_music_iterator is with \partial, and
\partial wraps its music event in (descend-to-context ... and thus is
impervious to this problem (the raw music event in itself will likely
crash LilyPond equally well).

I have no idea what Simple_music_iterator is for.  Possibly for getting
triggered at most once per time step, but then it should likely be
possible to get this effect without needing to actually compare moments.

Description:
Issue 3205: opening bar check causes crash if \score contains the \midi
block

This derives Bar_check_iterator from Music_iterator rather than from
Simple_music_iterator.

In
\score {
  { | d }
  \midi { }
}

the bar check iterator is being called while only the \Global context
exists.  That causes Score_performer::one_time_step to be called
without getting Score_performer::prepare to be called previously,
probably because the Score context is created at the wrong time.  The
Score_performer is not prepared for this situation.

I have no idea how to fix Simple_music_iterator, why it exists in the
first place and is written like it is, and why this appears to work.

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

Affected files:
  M lily/bar-check-iterator.cc


Index: lily/bar-check-iterator.cc
diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc
index a0fb8eaee17391231734a889ce2ec7e480615c98..ea4794897d3353f9fddae5c607ffe1f33fd78898 100644
--- a/lily/bar-check-iterator.cc
+++ b/lily/bar-check-iterator.cc
@@ -27,7 +27,7 @@
   Check bar checks. We do this outside the engravers so that you can
   race through the score using skipTypesetting to correct durations.
 */
-class Bar_check_iterator : Simple_music_iterator
+class Bar_check_iterator : Music_iterator
 {
 public:
   virtual void process (Moment);
@@ -44,7 +44,7 @@ Bar_check_iterator::Bar_check_iterator ()
 void
 Bar_check_iterator::process (Moment m)
 {
-  Simple_music_iterator::process (m);
+  Music_iterator::process (m);
   if (!m.to_bool ())
     {
       Context *tr = get_outlet ();





reply via email to

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