Tristan Van Berkom wrote: > On Sat, 2007-10-06 at 13:09 +0200, Bastiaan Veelo wrote: > >> Hi, >> >> I am writing my own widget, and while looking at the widgets in GTK I >> notice the following. >> >> If a widget draws on its parent GdkWindow, you generally see >> >> >>> widget->window = gtk_widget_get_parent_window (widget); >>> g_object_ref (widget->window); >>> >> But widget->window is not g_object_unref-ed anywhere in the widget >> implementation. Why shouldn't it? >> > > They are unreffed, it just takes a little while getting used to > reading the object oriented C code :) > > Notice: > gtkbutton.c::realize() does what you say, > get_parent_window(),g_object_ref(). > > gtkbutton.c::unrealize() does some gtkbutton specific things, and chains up > to the parent implementation with: > GTK_WIDGET_CLASS (gtk_button_parent_class)->unrealize (widget); > > gtkwidget.c::unrealize() is the implementation that it will fallback > on, thats where widget->window will be unreffed if > GTK_WIDGET_NO_WINDOW(widget). > > Cheers, > -Tristan > >
Ah, thanks. Bastiaan. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list