From: Carl Sorensen Date: Sun, 14 Nov 2010 00:41:43 +0000 (-0700) Subject: Fix 1382 X-Git-Tag: release/2.13.40-1~16^2~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=11cb980eb068c4d4bcaf20c27f8a0b8eda731c29;p=lilypond.git Fix 1382 --- diff --git a/input/regression/zero_staff_space.ly b/input/regression/zero_staff_space.ly new file mode 100644 index 0000000000..cc30e65786 --- /dev/null +++ b/input/regression/zero_staff_space.ly @@ -0,0 +1,17 @@ + +\version "2.13.40" +\header{ + + texidoc=" +Setting staff-space to 0 does not cause a segmentation fault. +" + +} + +\new Staff \with { + \override StaffSymbol #'staff-space = #0 + } { + \relative c' { + c1 + } +} diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index bec8c8001f..4dbd6d2d6b 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -81,9 +81,9 @@ Staff_symbol_referencer::get_position (Grob *me) if (st && c) { Real y = me->relative_coordinate (c, Y_AXIS) - - st->relative_coordinate (c, Y_AXIS); - - p += 2.0 * y / Staff_symbol::staff_space (st); + - st->relative_coordinate (c, Y_AXIS); + Real space = Staff_symbol::staff_space (st); + p = (space == 0) ? 0 : 2.0 * y / space; return p; } else if (!st) @@ -153,7 +153,6 @@ Staff_symbol_referencer::set_position (Grob *me, Real p) oldpos = get_position (me); } - Real ss = Staff_symbol_referencer::staff_space (me); me->translate_axis ((p - oldpos) * ss * 0.5, Y_AXIS); }