From fbc372d2ff590bed313b849683830051720906cd Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 3 Feb 2013 13:06:26 -0800 Subject: [PATCH] revert previous patch to font-metric, and apply a new patch from upstream which actually fixes the problem instead of hiding it --- debian/changelog | 5 +++-- lily/font-metric.cc | 3 --- lily/pango-font.cc | 4 ++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index c094903d76..117a83d888 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,9 @@ lilypond (2.14.2-4) unstable; urgency=low for the patch. * Fix noopt support to use --disable-optimising as ./configure does crazy things. - * Make sure that the guile garbage collection does not collect s in - font-metric.cc when it gets optimized away (closes: #684817) + * Apply patch from 13fc2437e2aaa9 to fix segfault in font-mark where a + garbage collection can trigger a null pointer dereference (closes: + #684817) -- Don Armstrong Sun, 23 Dec 2012 13:25:44 -0800 diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 4b4c2f802d..458528dd2e 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -106,9 +106,6 @@ Font_metric::mark_smob (SCM s) { Font_metric *m = (Font_metric *) SCM_CELL_WORD_1 (s); m->derived_mark (); - // we must do this to avoid s being optimized out and garbage - // collected; leading to a segfault above. - scm_remember_upto_here_1(s); return m->description_; } diff --git a/lily/pango-font.cc b/lily/pango-font.cc index a4fea75109..bb6fb3974c 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -47,6 +47,10 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap, PangoFontDescription const *description, Real output_scale) { + // This line looks stupid, but if we don't initialize physical_font_tab_ befo + // we allocate memory in scm_c_make_hash_table, then that could trigger a gar + // collection. + physical_font_tab_ = SCM_EOL; physical_font_tab_ = scm_c_make_hash_table (11); PangoDirection pango_dir = PANGO_DIRECTION_LTR; context_ = pango_context_new (); -- 2.39.5