[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invalid read in Context::properties_dict()
From: |
Dan Eble |
Subject: |
Re: invalid read in Context::properties_dict() |
Date: |
Mon, 31 Dec 2012 20:33:28 -0500 |
When the segfault occurs, multiple contexts in the call stack have already had
their mark_smob() method called. I guess that means they're all invalid, and
their memory might have been reallocated. Is that correct?
For a while, I have been using the following scheme code to define instrument
names for voices together with the notes for the voice, e.g.
aNotes = \relative g {
#(set-voice-name "T1")
c4 d e f . . .
}
Did something change in 2.16 that would make this start to segfault, or was it
always invalid and just now started failing by chance? Thanks.
#(define-markup-command (on-the-fly-context layout props procedure context arg)
(symbol? markup?)
"Apply the @var{procedure} markup command to
@var{arg}. @var{procedure} should take a single argument."
(let* ((anonymous-with-signature (lambda (layout props context arg)
(procedure layout props context arg))))
(set-object-property! anonymous-with-signature
'markup-signature
(list ly:context? markup?))
(interpret-markup layout props (list anonymous-with-signature context
arg))))
#(define (set-voice-name newName)
(let ((m (make-music 'ApplyContext)))
(define (do-it context)
(let* ((voiceNames (ly:context-property context 'voiceNames)))
(if (list? voiceNames)
(set! voiceNames (append voiceNames (list newName)))
(set! voiceNames (list newName)))
(ly:context-set-property! context 'voiceNames voiceNames)))
(set! (ly:music-property m 'procedure) do-it)
(context-spec-music m 'Staff)))
#(define-public (print-voice-names-or-default layout props context default)
(let ((voiceNames (ly:context-property context 'voiceNames)) % segfault
occurs in ly:context-property
(props (cons (list '(baseline-skip . 2.4)) props)))
(if (null? voiceNames)
(interpret-markup layout props (make-column-markup default))
(interpret-markup layout props (make-column-markup voiceNames)))))
#(define-public (set-auto-instrument-name defaultNames)
(let ((m (make-music 'ApplyContext)))
(define (do-it context)
(ly:context-set-property!
context 'instrumentName
(cons on-the-fly-context-markup
(list print-voice-names-or-default context defaultNames))))
(set! (ly:music-property m 'procedure) do-it)
(context-spec-music m 'Staff)))
--
Dan