Floating references



Some years ago I read about floating references as described in 

https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html

Of course that makes sense.

Newly created objects get ref count 1, but are floating. If they get
put into a container element, floating ref is converted to ordinary
ref, and ref count stays at 1.

But I was wondering, why for newly created objects ref count is not
just zero, so when the element is put into a container it is just
increased to one.

So there must be a reason why it can not work this way. Of course when
ref count drops to zero the element is deleted. But when a newly
created element just has ref count zero, where is the problem?


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