bug-lilypond
[Top][All Lists]
Advanced

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

Re: Segfault with define-music-function


From: Carl Sorensen
Subject: Re: Segfault with define-music-function
Date: Fri, 22 Oct 2010 07:02:57 -0600



On 10/22/10 3:10 AM, "Valentin Villenave" <address@hidden> wrote:

> The following code causes a segfault.
> LilyPond 2.13.36, GNU/Linux x86_64.
> 
> toto =
> #(define-music-function (parser location arg) (ly:music?)
>    (display (ly:event-property arg 'name))
>    (make-sequential-music arg))
> 
> { \toto a }

As near as I can tell, this code is triggering an infinite loop that fails
when the scheme heap overflows.

arg is *not* a stream-event, it's a music-event.

(display (ly:music-property arg 'name))

will give you the name EventChord.

Also, (make-sequential-music arg) generates an error, because
make-sequential-music needs a list as an argument.

(make-sequential-music (list arg))

will work fine.

So here's your code working properly:

toto =
#(define-music-function (parser location arg) (ly:music?)
   (display (ly:music-property arg 'name))
   (make-sequential-music (list arg)))

{ \toto a4 }


Segfaults are supposed to always be critical errors, but I think that in the
case of incorrect Scheme code, we shouldn't label it as a LilyPond error.

HTH,

Carl




reply via email to

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