Hmm, Now that I re read what I wrote, it seems like it was misleading, I didn't mean that the dispose should dereference other objects it holds more than once.
Anyway, quoting the GObject tutorial : "The dispose method is called when the object first knows it will be destroyed. It is supposed to release any references to resources that may need some advance warning due to reference cycles, or may be scarce and thus contended for by other objects. The dispose method may be called any number of times, and thus the code therein should be safe in that case. Guarding the dispose code with a static variable is a common practise. The object is also expected to be usable without unrecoverable error (such as a SEGFAULT) after dispose has been run, so some members cannot be freed or altered during the dispose process. Recoverable errors, such as returning error codes or NULL values, are fine. The finalize method finishes releasing the remaining resources just before the object itself will be freed from memory, and therefore it will only be called once. The two step process helps reduce cycles in reference counting schemes. " Is this inaccurate ? Please correct me if I am wrong -- Ali On Sun, Mar 23, 2008 at 2:13 PM, Ronald S. Bultje <[EMAIL PROTECTED]> wrote: > Hi, > > > On Sun, Mar 23, 2008 at 7:00 AM, Ali Sabil <[EMAIL PROTECTED]> wrote: > > The dispose will be called as > > many times as necessary to remove the references to other object (and thus > break > > possible cycles), and when the object's ref count drop to 0, the > > finalize is called to > > completely free any resource held by the object. > > No, both are called when the ref is zero and the dispose should only > dereference other objects it holds a reference to once. > > Ronald > _______________________________________________ desktop-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/desktop-devel-list
