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 - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to