Re: Freeing resources used in dialog
- From: Owen Taylor <owt1 cornell edu>
- To: "David M. Cook" <davecook hotmail com>
- Cc: gtk-list redhat com
- Subject: Re: Freeing resources used in dialog
- Date: 06 Mar 1998 17:53:23 -0500
"David M. Cook" <davecook@hotmail.com> writes:
> I've created a dialog with an hbox, pixmap, label and button. When
> I free up resources in my callback, do I have to free up each of these
> in turn, or will destroying the dialog do this for me? I'm using
> gtk_destroy_widget(gtk_widget_get_toplevel(button)) to destroy the
> dialog in my callback.
yes, no (yes), yes, yes.
That is, all widgets will be properly accounted for, but you
have to be a bit careful about the GdkPixmap (not the GtkPixmap)
you are using.
If you are only ever going to use the GdkPixmap in a single
GtkPixmap, you can do:
GdkPixmap *pixmap = gdk_pixmap_create_from_xpm (...);
GtkPixmap *pwidget = gtk_pixmap_new (pixmap, FALSE);
gdk_pixmap_unref (pixmap);
The GdkPixmap is created with a reference count of 1. The
GtkPixmap does _not_ take over that initial reference count,
but adds to it. So you are responsible for making sure that
initial reference gets released at some point.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]