Release memory for a GtkWindow



Title: Release memory for a GtkWindow

Hello,

here again a quaestion about memory freeing for GtkWindow objects.
I create my window like this

GtkWidget * create_window (void){
        GtkWidget * window = gtk_window_new (WINDOW_TOP_LEVEL);
        .......
       
        GtkButton * button = gtk_button_new ();
        ....
        gtk_widget_set_name (button, "button");
        gtk_widget_ref (button);
        gtk_widget_show (button);
        gtk_object_set_data_full (GTK_OBJECT (window), "button", button, (GtkDestroyNotify) gtk_widget_unref);
        gtk_container_add (GTK_CONTAINER (window), button);

        .........
        return window;
}


int main (){
        GtkWidget * toto = create_window ();

        return;
}


To destroy my window toto, do I only need to call gtk_object_destroy (GTK_OBJECT (toto)); or do I need to call gtk_widget_unref (button) and after call  gtk_object_destroy on the window ??

Thanks a lot for answers !

Isabelle



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