- if (lyric_iter_)
- scm_gc_unprotect_object (lyric_iter_->self_scm());
- if (music_iter_)
- scm_gc_unprotect_object (music_iter_->self_scm());
+ if (!music_context_->get_parent_context ())
+ {
+ /*
+ The melody has died.
+ We die too.
+ */
+ if (lyrics_context_)
+ lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
+ lyric_iter_ = 0;
+ set_music_context (0);
+ }
+
+ if (music_context_
+ && (start_new_syllable ()
+ || (busy_moment_ >= pending_grace_moment_))
+ && lyric_iter_->ok ())
+ {
+ Moment now = music_context_->now_mom ();
+ if (now.grace_part_ && !to_boolean (lyrics_context_->get_property ("includeGraceNotes")))
+ {
+ pending_grace_moment_ = now;
+ pending_grace_moment_.grace_part_ = Rational (0);
+ return;
+ }
+ else
+ {
+ pending_grace_moment_.set_infinite (1);
+ }
+
+ Moment m = lyric_iter_->pending_moment ();
+ lyrics_context_->set_property (ly_symbol2scm ("associatedVoiceContext"),
+ music_context_->self_scm ());
+ lyric_iter_->process (m);
+
+ music_found_ = true;
+ }
+
+ new_voice = find_voice ();
+ if (new_voice)
+ set_music_context (new_voice);