From: Carl Sorensen Date: Sun, 3 Jul 2011 21:07:05 +0000 (-0600) Subject: Fix segfault with ambitus and ligature (Issue 1715) X-Git-Tag: release/2.15.5-1~14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4fd0de625eba203265241fca20c504724013f534;p=lilypond.git Fix segfault with ambitus and ligature (Issue 1715) Add ligature-head-interface, and assign to NoteHead. Change acknowledger to acknowledge ligature-head instead of note-head Also includes regression test. --- diff --git a/input/regression/ambitus-with-ligature.ly b/input/regression/ambitus-with-ligature.ly new file mode 100644 index 0000000000..6f1ede4f73 --- /dev/null +++ b/input/regression/ambitus-with-ligature.ly @@ -0,0 +1,23 @@ +\version "2.14" + +\header { + texidoc = " +A @code{\Voice} should be able to contain both an @code{Ambitus_engraver} +and a @code{Mensural_ligature_engraver} without segfaulting. + " +} + +\score{ + { + \context Staff="default" { + \[ c'\longa c''\longa \] + } + } + \layout { + \context{ + \Voice + \consists Ambitus_engraver + \consists Mensural_ligature_engraver + } + } +} diff --git a/lily/include/ligature-engraver.hh b/lily/include/ligature-engraver.hh index 0308ab3e5f..4a2da856c2 100644 --- a/lily/include/ligature-engraver.hh +++ b/lily/include/ligature-engraver.hh @@ -31,7 +31,7 @@ protected: virtual void finalize (); DECLARE_ACKNOWLEDGER (rest); - DECLARE_ACKNOWLEDGER (note_head); + DECLARE_ACKNOWLEDGER (ligature_head); virtual void listen_ligature (Stream_event *ev); void process_music (); virtual Spanner *create_ligature_spanner () = 0; diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index be4917f0c7..99e86ed20b 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -143,7 +143,7 @@ Ligature_engraver::process_music () ligature_start_mom_ = now_mom (); - // TODO: dump cause into make_item/spanner. + // TODO: dump cause into make_item/spanner. // announce_grob (ligature_, events_drul_[START]->self_scm ()); } } @@ -194,15 +194,13 @@ Ligature_engraver::current_ligature () } void -Ligature_engraver::acknowledge_note_head (Grob_info info) +Ligature_engraver::acknowledge_ligature_head (Grob_info info) { if (ligature_) { primitives_.push_back (info); if (info.grob () && brew_ligature_primitive_proc != SCM_EOL) - { - info.grob ()->set_property ("stencil", brew_ligature_primitive_proc); - } + info.grob ()->set_property ("stencil", brew_ligature_primitive_proc); } } diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index d6e8eed3ca..ead5f1f0ad 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -59,7 +59,7 @@ protected: virtual Spanner *create_ligature_spanner (); virtual void build_ligature (Spanner *ligature, vector primitives); DECLARE_TRANSLATOR_LISTENER (ligature); - + public: TRANSLATOR_DECLARATIONS (Mensural_ligature_engraver); @@ -78,7 +78,7 @@ Mensural_ligature_engraver::listen_ligature (Stream_event *ev) Mensural_ligature_engraver::Mensural_ligature_engraver () { - brew_ligature_primitive_proc = + brew_ligature_primitive_proc = Mensural_ligature::brew_ligature_primitive_proc; } @@ -473,7 +473,7 @@ Mensural_ligature_engraver::build_ligature (Spanner *ligature, } ADD_ACKNOWLEDGER (Mensural_ligature_engraver, rest); -ADD_ACKNOWLEDGER (Mensural_ligature_engraver, note_head); +ADD_ACKNOWLEDGER (Mensural_ligature_engraver, ligature_head); ADD_TRANSLATOR (Mensural_ligature_engraver, /* doc */ diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index df3a3d4ec4..5402a8fb01 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -102,7 +102,7 @@ Vaticana_ligature_engraver::listen_ligature (Stream_event *ev) Vaticana_ligature_engraver::Vaticana_ligature_engraver () { - brew_ligature_primitive_proc = + brew_ligature_primitive_proc = Vaticana_ligature::brew_ligature_primitive_proc; augmented_primitives_.clear (); } @@ -742,7 +742,7 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature, } ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, rest); -ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, note_head); +ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, ligature_head); ADD_TRANSLATOR (Vaticana_ligature_engraver, /* doc */ "Handle ligatures by glueing special ligature heads" diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index a7090de032..735b9c7895 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -123,6 +123,11 @@ accidentals)." "A key cancellation." '()) +(ly:add-interface + 'ligature-head-interface + "A note head that can become part of a ligature." + '()) + (ly:add-interface 'ligature-bracket-interface "A bracket indicating a ligature in the original edition." diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index a5c13d5195..c57675530b 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1439,6 +1439,7 @@ (interfaces . (font-interface gregorian-ligature-interface ledgered-interface + ligature-head-interface mensural-ligature-interface note-head-interface rhythmic-grob-interface