How to destory GtkWindow without memory leak



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



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