Re: gtk_object_destroy and floating objects

At 06:44 PM 12/30/99 -0500, you wrote:

>In answer to your problem with GtkAda, I'd say that almost every
>language binding for GTK+ should ref and sink objects immediately on
>creation. The only reason that float/sink exists at all in GTK+ is
>because C doesn't have reference counting or garbage collection for
>its pointers, so if we want to make
>  button = gtk_button_new ();
>  gtk_container_add (GTK_CONTAINER (window), button);
>not a leak, and not prematurely destroy button we have to do something
>like float/sink. But languages bindings almost always have some sort
>of proxy objects, and the proxy object can and should hold a normal
>reference count to the GtkObject.

FWIW, Perl/Gtk sinks objects on explicit creation ("new Gtk::Button") but 
doesn't sink pointers that merely get passed into Perl-land (say from the 
contents of another object). This seems fairly important (although it may 
have no significant impact) because if an intentionally floating object was 
accidentally seen in a Perl scope, I expect it would get garbage collected 
as soon as it went out of Perl scope. (Which makes me wonder whether my 
garbage collection algorithm should, or already does, refuse floating objects.)

- Kenneth
[Normal .sig on vacation, along with me.]

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