[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol.
From: |
Carl . D . Sorensen |
Subject: |
Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden) |
Date: |
Thu, 07 May 2020 09:03:53 -0700 |
Here's a thought.
https://codereview.appspot.com/576090043/diff/557790043/lily/multi-measure-rest.cc
File lily/multi-measure-rest.cc (right):
https://codereview.appspot.com/576090043/diff/557790043/lily/multi-measure-rest.cc#newcode268
lily/multi-measure-rest.cc:268: bool oneline = (!staff) ||
Staff_symbol::line_positions (staff).size() == 1;
On 2020/05/07 15:12:03, Valentin Villenave wrote:
> On 2020/05/07 12:18:48, Dan Eble wrote:
> > If there is no staff symbol, then there isn't even one line. Are you
sure you
> > don't want this?
> > bool oneline = staff ? /*etc.*/ : false;
>
> No, I actually want oneline to be true . I did consider changing the
variable
> name to no_multiple_lines, because that’s what it’s really about. I
also
> considered adding a comment such as:
> // If there is no StaffSymbol, print MMrests on one (invisible) line.
>
> > Incidentally, I am surprised to see the amount of work involved in
determining
> > whether the staff has one line. It's not the kind of thing one
expects to
> > involve heap allocation.
>
> I suspect this sort-of mirrors the way you’d do it in Scheme:
> (if (> (length
> (ly:grob-property
> (ly:grob-object grob 'staff-symbol)
> 'line-positions))
> 0)
> etc.
>
> If you have a simpler syntax in mind, please share :-)
>
> Cheers,
> -- V.
What about changing the name from oneline to specialcase? Or maybe
default_position? Then it would naturally apply to both no staff symbol
and one-line staff symbol.
https://codereview.appspot.com/576090043/
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), nine . fierce . ballads, 2020/05/07
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), v . villenave, 2020/05/07
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden),
Carl . D . Sorensen <=
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), nine . fierce . ballads, 2020/05/08
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), nine . fierce . ballads, 2020/05/08
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), v . villenave, 2020/05/09
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), nine . fierce . ballads, 2020/05/09
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), v . villenave, 2020/05/09
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), nine . fierce . ballads, 2020/05/09
- Re: Fix #5964: MM Rests shouldn’t segfault when there’s no StaffSymbol. (issue 576090043 by address@hidden), v . villenave, 2020/05/09