Re: GtkWindow destroy problem



Martin Baulig <martin home-of-linux org> writes:

> Darin Adler <darin bentspoon com> writes:
> 
> > on 9/6/01 10:04 AM, Martin Baulig at martin home-of-linux org wrote:
> > 
> > > Ok, so just to make sure I did it right, is the following correct ?
> > > 
> > >     o = g_object_new (GTK_TYPE_WINDOW, NULL);
> > >     gtk_object_ref (o);
> > >     gtk_object_sink (o);
> > >     /* ... some time later ... */
> > >     g_object_unref (o);
> > 
> > This code is correct, but it won't make the window go away. The window's
> > top-level owner still owns it, and it won't go away until someone destroys
> > it. But perhaps that's what you want.
> 
> Well, the g_object_unref() happens in guile's garbage collector.
> 
> So, there are two situations:
> 
> a) The window has been created in guile (using (make <gtk-window> #:type ...))
> 
> b) The window has been created and returned by a C function.
> 
> However, I think in both cases it's reasonable to just unref the window and not
> destroy it - garbage collection may happen at any time and only indicates that
> the scheme side is "done with the object" (ie. doesn't need it anymore since it
> can't be accessed anymore from scheme).

Windows definitely shouldn't be destroyed as a side-effect of
garbage collection in guile. You can call gtk_window_list_toplevels()
at any time and get a list of the currently existant windows.

Regards,
                                        Owen 





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