lilypond-devel
[Top][All Lists]
Advanced

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

Re: GC question


From: Han-Wen Nienhuys
Subject: Re: GC question
Date: Thu, 18 Aug 2005 11:25:33 +0200
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Erik Sandberg wrote:
class A {
  SCM b_;
  A() { b_ = get_b (); scm_gc_protect_object (b_); }
  ~A() { scm_gc_unprotect_object (b_); }
  ...
};

Now if a third smob C contains an A object, as in

class C {
  A a_;
  ...
  DECLARE_SMOBS (C);
};

.. then A's gc_unprotect will be called during the gc sweep.

Is my problem related to the smob macros in Lilypond? (if not, I should ask on guile-user instead).


do the following:

  make A::protect() and A::unprotect().

In C::C call A::unprotect, and use C::mark to mark the smob. You will also need machinery to make sure unprotect() isn't called if the B is no longer protected.

--
 Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen




reply via email to

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