[Top][All Lists]

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

Re: Fixes footnote automatic numbering. (issue 4877041)

From: David Kastrup
Subject: Re: Fixes footnote automatic numbering. (issue 4877041)
Date: Mon, 14 Nov 2011 14:31:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

"address@hidden" <address@hidden> writes:

> Thanks for the feedback!  A couple questions below.
> On Nov 14, 2011, at 12:34 PM, address@hidden wrote:
>> lily/ if (s->original ())
>> You don't check for success of the dynamic_cast before using it.  Is
>> that a problem?
>> lily/ Grob *me = unsmob_grob (smob);
>> According to the compiler, getting the pointer me is the last operation
>> for which smob is needed.  After that, it is free for garbage
>> collection.
>> If you are not sure that other references to smob keep it from being
>> collected, you need to write
>> scm_remember_upto_here_1 (smob)
>> at the place where garbage collecting smob will no longer be a problem.
>> That's probably after all the relevant info is entered in grobs_scm.
> How is this function different from other callback functions that use
> the convention Grob *me = unsmob_smob (smob); ?  I understand what
> you're saying with scm_remember_upto_here, but I don't see why this
> function would need it where other callback functions don't.

I was just doing peep-hole review.  I have no idea about the general
conventions and code quality, or whether there is a contract about which
grobs can be relied on to have references when in callbacks, and for
which grobs the callback might be the last user.

> Also, is it safe to put a smob up for garbage collection after it is
> put into a grob array?  That is, the next time that the grob array is
> unsmobed, will it potentially contain a smob that has been garbage
> collected?

Any sane structure marks its contents during garbage collection as used.

The respective code in grob_array has been commented out by Jan.  The
commit logs of the relevant commits give no clue whatsoever why he would
do something like that.

So no, having a smobbed grob array is no guarantee that its contents
have not already been collected.

That's entirely insane.  There might be a reason for this, but it has
not been documented.

Ask Jan.

David Kastrup

reply via email to

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