Re: GObject Destruction



On Wed, 19 Dec 2012 18:55:40 +0100, Nicola Fontana <ntd entidi it> wrote:
> By exposing only dispose() and internalizing finalization in
> libgobject.

How can you do this without one of the following:
(a) Requiring that objects must not have any data, even internal,
    that cannot be NULL[*] during the object lifetime.  I.e. all data
    would require the NULL protection, even those that do not require
    it in the current scheme.
(b) Teaching GObject how to free the internal data of your object.
    But wait, there is already a method that lets GObject do this: it
    is called finalize().

[*] Or, in general, unset in some other manner.

> We are saying the same thing: if a dynamic string is protected
> against NULL throughout your code (no "special" protection
> intended here), freeing and nullifying it in dispose() or freeing
> in finalize() gives the same final result.

Yes, here we are saying the same thing.

Where we differ, is that you seem to propose that all member data should
be like this.

In many cases, internal data can be assumed to just exist in all public
methods *and* during the reference-cycle breaking stage.  So no NULL
protection is necessary, they are just plainly freed in finalize().

Regards,

Yeti



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