lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix for segfault in Font_metric::mark_smob (optimization; Debian bug


From: Don Armstrong
Subject: Re: Fix for segfault in Font_metric::mark_smob (optimization; Debian bug #684817)
Date: Tue, 1 Jan 2013 12:03:01 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, 28 Dec 2012, David Kastrup wrote:
> Don Armstrong <address@hidden> writes:
> > The attached patch fixes a segfault in mark_smob where s gets
> > optimized away and garbage collected before m goes out of scope,
> > leading to a segfault.
> >
> > There may be other cases of this bug floating around, but I didn't
> > look particularly hard for them.
> 
> > diff --git a/lily/font-metric.cc b/lily/font-metric.cc
> > index 6990afe..8ca88ef 100644
> > --- a/lily/font-metric.cc
> > +++ b/lily/font-metric.cc
> > @@ -106,6 +106,9 @@ 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_;
> >  }
> 
> That makes precious little sense: mark_smob is only called while garbage
> collection is in progress, so garbage collection can't be triggered in
> its middle.

The backtrace for this bug is here: 
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=55;filename=lilypond-segfault.txt;att=1;bug=684817

And the attached patch does fix it; however, it's possible that this
is just because the patch obfuscates the actual bug. I'm certainly not
an expert in guile nor lilypond internals at all.


Don Armstrong

-- 
Your absence has gone through me
Like thread through a needle.
Everything I do is stitched with its color.
 -- W. S. Merwin "Poetry in Motion" p107

http://www.donarmstrong.com              http://rzlab.ucr.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]