Re: checking for memory leaks in gtk
- From: jcupitt gmail com
- To: "Harinandan S" <harinandans gmail com>
- Cc: gtk-list gnome org
- Subject: Re: checking for memory leaks in gtk
- Date: Wed, 14 May 2008 12:16:08 +0100
2008/5/14 Harinandan S <harinandans gmail com>:
> I dont have any pixmaps or images in my sample application.
You don't directly, but the theme engine you are using might. I tried
your program under valgrind and it reports no leaks, so I imagine you
are OK. I don't have a directfb install or a windows machine handy
though, so I can't test there.
> Am i calling the correct APIs? Help is greatly appreciated. Somehow i
> feel destroy is not happening properly!
I think you're OK. I'd change a few things on style grounds though:
void
on_close_clicked (GtkButton * button, gpointer user_data)
{
GtkWidget *window = GTK_WIDGET (user_data);
gtk_widget_destroy (window);
}
I'd use a GTK_WIDGET() cast here, it'll check the pointer for you, much safer.
You shouldn't use gtkfixed unless you REALLY have to. gtk has a large
set of layout widgets that can do all this for you automatically and
attractively. As a bonus, when someone translates your application and
the sizes of all the text strings changes, you won't need to
reposition everything.
gtk_button_new_with_mnemonic () is a strange one to use, that's really
for menus. gtk_button_new_from_stock () might be better.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]