summaryrefslogtreecommitdiff
path: root/scm/bar-line.scm
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2013-11-17 19:29:06 +0100
committerDavid Kastrup <dak@gnu.org>2013-11-22 14:21:12 +0100
commit539fa974c50b632fd6d3c4a65dbf988bb2880e2a (patch)
tree2ed38ebce656ab1f9bb88a7e866ac7d6ced517af /scm/bar-line.scm
parent67370eabfb36cd70d9fbf6bcff53a1ac3b5b18c3 (diff)
Issue 3663: Crash with \repeat ... \alternative and \remove "Bar_engraver"
This approach is just poking around in the dark and removing Scheme error messages. In particular substituting the original glyph for left-bar-line and right-bar-line (when missing) in calls to span-bar::compound-bar-line seems fishy, and the original logic for setting left-bar-broken if left-bar-line is not even present is also not clear to me. The results for the example in the bug report: form = \new Staff \with { \remove "Bar_engraver" } \repeat volta 2 { s1 } \alternative { s1 % first ending s1 % second ending } % form \score { << \form >> } % score are also not identical with the 2.16 results: the volta brackets now run into each other; before there was a gap. It fixes the crash. I have no idea what a proper fix would look like.
Diffstat (limited to 'scm/bar-line.scm')
-rw-r--r--scm/bar-line.scm59
1 files changed, 30 insertions, 29 deletions
diff --git a/scm/bar-line.scm b/scm/bar-line.scm
index 03c6f80815..302936e49c 100644
--- a/scm/bar-line.scm
+++ b/scm/bar-line.scm
@@ -910,50 +910,51 @@ of the volta brackets relative to the bar lines."
line-thickness
1/2))
(bar-array (ly:grob-object grob 'bars))
- (bar-array-length (ly:grob-array-length bar-array))
;; the bar-array starts with the uppermost bar line grob that is
;; covered by the left edge of the volta bracket; more (span)
;; bar line grobs from other staves may follow
- (left-bar-line (if (> bar-array-length 0)
- (ly:grob-array-ref bar-array 0)
- '()))
+ (left-bar-line (and (ly:grob-array? bar-array)
+ (positive? (ly:grob-array-length bar-array))
+ (ly:grob-array-ref bar-array 0)))
;; we need the vertical-axis-group-index of the left-bar-line
;; to find the corresponding right-bar-line
- (vag-index (if (null? left-bar-line)
- -1
- (ly:grob-get-vertical-axis-group-index left-bar-line)))
+ (vag-index (and left-bar-line
+ (ly:grob-get-vertical-axis-group-index left-bar-line)))
;; the bar line corresponding to the right edge of the volta bracket
;; is the last entry with the same vag-index, so we transform the array to a list,
- ;; reverse it and search for suitable entries:
- (filtered-grobs (filter (lambda (e)
- (eq? (ly:grob-get-vertical-axis-group-index e)
- vag-index))
- (reverse (ly:grob-array->list bar-array))))
- ;; we need the first one (if any)
- (right-bar-line (if (pair? filtered-grobs)
- (car filtered-grobs)
- '()))
+ ;; reverse it and search for the first suitable entry from
+ ;; the back
+ (right-bar-line (and left-bar-line
+ (find (lambda (e)
+ (eqv? (ly:grob-get-vertical-axis-group-index e)
+ vag-index))
+ (reverse (ly:grob-array->list bar-array)))))
;; the left-bar-line may be a #'<Grob Item >,
;; so we add "" as a fallback return value
- (left-bar-glyph-name (if (null? left-bar-line)
- (string annotation-char)
- (ly:grob-property left-bar-line 'glyph-name "")))
- (right-bar-glyph-name (if (null? right-bar-line)
- (string annotation-char)
- (ly:grob-property right-bar-line 'glyph-name "")))
- (left-bar-broken (or (null? left-bar-line)
- (not (zero? (ly:item-break-dir left-bar-line)))))
- (right-bar-broken (or (null? right-bar-line)
- (not (zero? (ly:item-break-dir right-bar-line)))))
+ (left-bar-glyph-name (if left-bar-line
+ (ly:grob-property left-bar-line 'glyph-name "")
+ (string annotation-char)))
+ (right-bar-glyph-name (if right-bar-line
+ (ly:grob-property right-bar-line 'glyph-name "")
+ (string annotation-char)))
+ ;; This is the original logic. It flags left-bar-broken if
+ ;; there is no left-bar-line. That seems strange.
+ (left-bar-broken (not (and left-bar-line
+ (zero? (ly:item-break-dir left-bar-line)))))
+ (right-bar-broken (not (and right-bar-line
+ (zero? (ly:item-break-dir
+ right-bar-line)))))
+ ;; Revert to current grob for getting layout info if no
+ ;; left-bar-line available
(left-span-stencil-extent (ly:stencil-extent
(span-bar::compound-bar-line
- left-bar-line
+ (or left-bar-line grob)
left-bar-glyph-name
dummy-extent)
X))
(right-span-stencil-extent (ly:stencil-extent
(span-bar::compound-bar-line
- right-bar-line
+ (or right-bar-line grob)
right-bar-glyph-name
dummy-extent)
X))
@@ -968,7 +969,7 @@ of the volta brackets relative to the bar lines."
(- (max 0 (interval-end left-span-stencil-extent))
(max 0 (interval-end (ly:stencil-extent
(bar-line::compound-bar-line
- left-bar-line
+ (or left-bar-line grob)
left-bar-glyph-name
dummy-extent)
X)))