Re: Floating references

6.06.2017 22:28 Chris Vine <vine35792468 gmail com> wrote:
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.

As far as I understand owned object were supposed to be the widgets
contained inside the containers. Not all widgets are contained (toplevel
windows are not), also not all objects are widgets.

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.

I can't tell for sure. Maybe (as I wrote before) the floating reference
feature was not always expected to exist, maybe it simplified some
things, maybe it does not matter that much and the system works the same
no matter if the initial reference count is 0 or 1 or some other number.



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