Re: Floating references

On Tue, 6 Jun 2017 22:10:39 +0200 (CEST)
Rafal Luzynski <digitalfreak lingonborough com> wrote:
6.06.2017 21:41 Chris Vine <vine35792468 gmail com> wrote:
No one is suggesting reworking. This is no more than intellectual
interest in the original design choice.  

I wasn't around when this design choice was made so I can only
guess. I can only repeat what Tristan has already said:
this is a feature of GInitiallyUnowned and its descendants
rather than all GObject instances. At least that was originally,
maybe it was changed later but remained to avoid breaking the
backward compatibility.

GObjects not derived from GInitiallyUnowned are indeed weird, as I think
you are suggesting.  They start with a reference count of 1 but without
an owner.

But on further thought I suspect you are right: the floating reference
was to circumvent this problem.  So I guess the question is why pure
(non-GInitiallyUnowned) GObjects start with a reference count of 1,
instead of a count of 0 as in other similar implementations.  Starting
with a count of 0 would have made floating references unnecessary.


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