Re: How to destory GtkWindow without memory leak



I seem to be missing something here...   it appears that that your
while(TRUE) loop will never allow the gtk_main call to happen, hence you
are simply initializing, showing, and destroying the window widget ad
infinitum.  

The call to gtk_widget_show_all is not necessary here, since there are
no children inserted into the window widget by your code.

On Tue, 2005-01-18 at 11:40, Masao Mutoh wrote:
Hi all,

How can I avoid memoryleak the code below?
I want to free the memory for the GtkWindow in each 
of the loop.

I noticed to call gtk_widget_show_all() causes the problem,
but I couldn't solve it...

--------
#include <gtk/gtk.h>

int main(int argc, char** argv){  
  GtkWidget* window;
  gtk_init(&argc, &argv);

  while(TRUE){
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show_all(window);
    gtk_widget_destroy(window);
  }
  gtk_main();
  return 0;
}
--------

Thanks in advance,
Masao
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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