From: Jan Nieuwenhuizen Date: Sun, 1 Feb 2004 10:35:05 +0000 (+0000) Subject: (start_new_syllable): X-Git-Tag: release/2.1.23~137 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f4fc86d41170c19ba264c97cb36f3e5811cb1943;p=lilypond.git (start_new_syllable): Construct children before accessing property from emtpy lyrics_context_. (construct_children): Find thread before finding LyricsVoice. Create LyricsVoice one if none found, fixes crash (thanks Erik Sandberg). --- diff --git a/ChangeLog b/ChangeLog index e2100aa0d2..89ddc56e6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-02-01 Jan Nieuwenhuizen + + * lily/new-lyric-combine-music-iterator.cc (start_new_syllable): + Construct children before accessing property from emtpy + lyrics_context_. + (construct_children): Find thread before finding LyricsVoice. + Create LyricsVoice one if none found, fixes crash (thanks Erik + Sandberg). + 2004-01-31 Jan Nieuwenhuizen * cygwin/: Forward port. diff --git a/THANKS b/THANKS index 7404cba212..d52980667e 100644 --- a/THANKS +++ b/THANKS @@ -13,6 +13,7 @@ Werner Lemberg Nicolas Sceaux Nick Busigin Matthias Kilian +Erik Sandberg Release 2.0 *********** diff --git a/lily/new-lyric-combine-music-iterator.cc b/lily/new-lyric-combine-music-iterator.cc index f2eff8b6f3..b5d0729108 100644 --- a/lily/new-lyric-combine-music-iterator.cc +++ b/lily/new-lyric-combine-music-iterator.cc @@ -71,6 +71,9 @@ New_lyric_combine_music_iterator::start_new_syllable () if (!b) return false; + if (!lyrics_context_) + construct_children (); + if (!to_boolean (lyrics_context_->get_property ("ignoreMelismata"))) { bool m = music_context_->try_music (melisma_playing_ev); @@ -159,12 +162,15 @@ New_lyric_combine_music_iterator::construct_children () Music *m = unsmob_music (get_music ()->get_mus_property ("element")); lyric_iter_ = unsmob_iterator (get_iterator (m)); - if (lyric_iter_) - { - lyrics_context_ = find_context_below (lyric_iter_->report_to (), "LyricsVoice", ""); - } - find_thread (); + + if (lyric_iter_) + lyrics_context_ = find_context_below (lyric_iter_->report_to (), + "LyricsVoice", ""); + + if (music_context_ && !lyrics_context_) + lyrics_context_ = music_context_ + ->find_create_translator (ly_symbol2scm ("LyricsVoice"), "", SCM_EOL); } void @@ -180,19 +186,21 @@ New_lyric_combine_music_iterator::find_thread () while (t && t->daddy_trans_) t = t->daddy_trans_; - String name = ly_scm2string (voice_name); - Translator_group* voice = find_context_below (t, "Voice", name); + String name = ly_scm2string (voice_name); + Translator_group *voice = find_context_below (t, "Voice", name); Translator_group *thread = 0; if (voice) thread = find_context_below (voice, "Thread", ""); else - get_music ()->origin ()->warning (_f("Cannot find Voice: %s\n", name.to_str0())); + get_music ()->origin ()->warning (_f ("Cannot find Voice: %s\n", + name.to_str0 ())); if (thread) music_context_ = thread; if (lyrics_context_ && voice) - lyrics_context_->set_property ("associatedVoiceContext", voice->self_scm ()); + lyrics_context_->set_property ("associatedVoiceContext", + voice->self_scm ()); } } } diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 87bede03b8..9d0ab733be 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -169,7 +169,8 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations) ret = daddy_trans_->find_create_translator (n, id, operations); else { - warning (_f ("can't find or create `%s' called `%s'", ly_symbol2string (n).to_str0 (), id)); + warning (_f ("Cannot find or create `%s' called `%s'", + ly_symbol2string (n).to_str0 (), id)); ret =0; } return ret;