Floating references

2017-06-06 Thread Stefan Salewski
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

Re: Floating references

2017-06-06 Thread Tristan Van Berkom
On Tue, 2017-06-06 at 11:50 +0200, Stefan Salewski wrote: > 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

Re: Floating references

2017-06-06 Thread Rafal Luzynski
6.06.2017 11:50 Stefan Salewski wrote: > [...] > 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

Re: Floating references

2017-06-06 Thread Chris Vine
On Tue, 06 Jun 2017 19:35:40 +0900 Tristan Van Berkom wrote: > On Tue, 2017-06-06 at 11:50 +0200, Stefan Salewski wrote: > > 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. > > In a w

Re: Floating references

2017-06-06 Thread Chris Vine
On Tue, 6 Jun 2017 21:23:09 +0200 (CEST) Rafal Luzynski wrote: > 6.06.2017 11:50 Stefan Salewski wrote: > > [...] > > 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 mu

Re: Floating references

2017-06-06 Thread Rafal Luzynski
6.06.2017 21:41 Chris Vine 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 GInit

Re: Floating references

2017-06-06 Thread Chris Vine
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. Chris ___ gtk-list mailing

Re: Floating references

2017-06-06 Thread Rafal Luzynski
tart 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,

Re: Floating references

2017-06-06 Thread Greg Ewing
Chris Vine wrote: 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. CPython starts reference counts at 1, and it works perfectly well -- the code that allocates the object initiall

Re: Floating references

2017-06-07 Thread Tristan Van Berkom
On Tue, 2017-06-06 at 21:28 +0100, Chris Vine wrote: > On Tue, 6 Jun 2017 22:10:39 +0200 (CEST) > > Rafal Luzynski wrote: > > > > > > 6.06.2017 21:41 Chris Vine wrote: > > > > > > [...] > > > No one is suggesting reworking. This is no more than intellectual > > > interest in the original design

Re: Floating references

2017-06-07 Thread Tristan Van Berkom
On Tue, 2017-06-06 at 23:32 +0200, Rafal Luzynski wrote: > > 6.06.2017 22:28 Chris Vine 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 under

Re: Floating references

2017-06-08 Thread Rafal Luzynski
7.06.2017 09:45 Tristan Van Berkom wrote: > > > On Tue, 2017-06-06 at 23:32 +0200, Rafal Luzynski wrote: > > > 6.06.2017 22:28 Chris Vine wrote: > > > > > > [...] > > > GObjects not derived from GInitiallyUnowned are indeed weird, as I think > > > you are suggesting. They start with a reference c