From 11cb980eb068c4d4bcaf20c27f8a0b8eda731c29 Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Sat, 13 Nov 2010 17:41:43 -0700 Subject: [PATCH] Fix 1382 --- input/regression/zero_staff_space.ly | 17 +++++++++++++++++ lily/staff-symbol-referencer.cc | 7 +++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 input/regression/zero_staff_space.ly 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); } -- 2.39.5