[Top][All Lists]

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

Re: Bracketized key signature: \key c \major causes a core dump

From: Thomas Morley
Subject: Re: Bracketized key signature: \key c \major causes a core dump
Date: Fri, 2 Sep 2016 10:59:10 +0200

2016-09-02 10:07 GMT+02:00 David Kastrup <address@hidden>:
> Rutger Hofman <address@hidden> writes:
>> Good morning list,
>> I use the snippet http://lsr.di.unimi.it/LSR/Snippet?id=647 to get a
>> key signature in brackets. This works fine for \key other than c
>> \major, but if I specify c \major I get a core dump:
>> Preprocessing graphical objects...lilypond:
>> /home/gub/NewGub/gub/target/linux-64/src/lilypond-git.sv.gnu.org--lilypond.git-release-unstable/lily/skyline.cc:94:
>> Building::Building(Real, Real, Real, Real): Assertion `start_height ==
>> end_height' failed.
>> Aborted (core dumped)
>> Rutger Hofman
>> Amsterdam
>> \version "2.19.35"
>> {
>>     % http://lsr.di.unimi.it/LSR/Snippet?id=647
>>     \override Staff.KeySignature.stencil = #(lambda (grob)
>> (bracketify-stencil (ly:key-signature-interface::print grob) Y 0.1 0.2
>> 0.1))
>>     \key c \major
>>     c''
>> }
> Well, apparently the code/snippet is not all that well-prepared for what
> amounts to an empty key signature.  However, the triggered problem is
> deep in the bowels of LilyPond and is a complaint about inconsistent
> internal data.  This error should not be triggerable from user code.
> While the user code and/or the code underlying bracketify-stencil might
> warrant catering for this particular case, the internals must still not
> be confused in this manner.  So this will likely warrant fixes in more
> than one place even though the symptom might be curable by just changing
> the definition of bracketify-stencil.
> --
> David Kastrup

Below an in-file fix curing the symptoms.

David, apart from fixing the internals, does it make sense to prepare
a patch for bracketify-stencil at the lines of:

\version "2.19.47"

%% not public, c/p from lily-library.scm
#(define (other-axis a)
  (remainder (+ a 1) 2))

%% doesn't makes sense to bracketify an empty stencil, hence we just return it.
#(define-public (bracketify-stencil stil axis thick protrusion padding)
  "Add brackets around @var{stil}, producing a new stencil."
  (if (ly:stencil-empty? stil)
      (let* ((ext (ly:stencil-extent stil axis))
             (lb (ly:bracket axis ext thick protrusion))
             (rb (ly:bracket axis ext thick (- protrusion))))
        (set! stil
              (ly:stencil-combine-at-edge stil (other-axis axis) 1 rb padding))
        (set! stil
              (ly:stencil-combine-at-edge stil (other-axis axis) -1 lb padding))

%% Example

\relative c'' {
  \override Staff.KeySignature.stencil = #(lambda (grob)
    (bracketify-stencil (ly:key-signature-interface::print grob) Y 0.1 0.2 0.1))

    \key c \major


reply via email to

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