Re: GObjectClass.dispose and bringing objects back to life



On 12/04/2011 05:03 PM, David Nečas wrote:
> On Sun, Dec 04, 2011 at 01:40:58PM +0000, Emmanuele Bassi wrote:
>> this is, of course, not true: GNOME is full of badly written GObject
>> code, mostly because it has been written at various stages of the
>> learning process of various people. plus, the documentation is not
>> entirely clear in a lot of places, thus the learning process can (and
>> effectively is) broken.
>> ...
>>
>> objects should obviously not be in a fully functional state after
>> dispose - but they should be in a stable state, so that other objects
>> referencing them from outside of the boundaries of their code space
>> can still hold a valid reference to them, until such time that every
>> reference can be released.
> So, who thinks this idea is not actually inherently inconsistent please
> please specify in the documentation, based on your rationale, how are
> objects supposed to behave in the disposed state.  Namely with respect
> to (not) keeping impossible invariants, returning nontrivial
> no-longer-available values, methods that normally create or acquire
> something before returning it and other practical issues.  Or say that
> there can be certain things the object owners may not do with disposed
> objects.  Or anything.  This
>
>      The object is also expected to be able to answer client method
>      invocations (with possibly an error code but no memory violation)
>      until finalize is executed.
>
> has as, a practical guide, approximately the same value as ‘people
> should live together in peace’.
As it has been said before dispose and finalize get called when an
object is getting destroyed. Dispose might get called a few times to
break ref-cycles. Finalize is getting called a single time. I'd say most
objects can't be revived in a meaning ful way when finalize is hit. I'd
say this is also almost true for dispose. One would need to revive them
on the first dispose cycle and unreffing anything.

Stefan
> Thank you in advance,
>
> Yeti
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list



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