Re: gtk_object_sink in glade_palette_init
- From: Philippe Bertin <philippe bertin telenet be>
- To: tomas tuxteam de
- Cc: gtk-app-devel-list gnome org
- Subject: Re: gtk_object_sink in glade_palette_init
- Date: Tue, 28 Nov 2006 23:17:50 +0100
Thanks for shedding some light on this piece of code. There's some more
light at the end of my dark GTK-knowledge tunnel.
AFAIU, after the _new() the box has a special reference to it: the ref
count is one, but it is marked as "floating"[1]. Now gtk_object_sink()
decrements the ref coung by one *only* if the object is marked as
floating and does nothing otherwise. So the net effect of this code is
to clear the floating flag. See for example
<http://developer.gnome.org/doc/GGAD/z57.html>
for an explanation.
- ------------
[1] What this means in terms of practical consequences isn't quite clear
to me (perhaps some guru cares to give a pointer), but the idea is to
keep a ref to an yet-unused object you don't want to disappear from
under you before you've put it safely somewhere. Think of it as "half
referenced".
Note that putting the object in a container or whatever sinks() it and
that leads to quite natural code without ref leaks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]