[Top][All Lists]
[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: |
David Kastrup |
Subject: |
Re: Fix for segfault in Font_metric::mark_smob (optimization; Debian bug #684817) |
Date: |
Fri, 28 Dec 2012 21:25:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
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.
--
David Kastrup