Freeing memory
- From: Lucas Clemente Vella <lvella triang com br>
- To: gtk-app-devel-list gnome org
- Subject: Freeing memory
- Date: Fri, 18 Apr 2003 18:43:27 -0300
Running the code below:
#include <gtk/gtk.h>
void swq(GtkWidget *main_window, gpointer data){
GtkWidget *window, *message;
gint decision;
window = gtk_dialog_new_with_buttons("Confirmation",
GTK_WINDOW(main_window), GTK_DIALOG_MODAL, "Yes", GTK_RESPONSE_YES,
"No", GTK_RESPONSE_NO, NULL);
message = gtk_label_new("Are you sure you want to quit?");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), message, TRUE,
TRUE, 0);
gtk_widget_show(message);
decision = gtk_dialog_run(GTK_DIALOG(window));
if(decision == GTK_RESPONSE_YES) gtk_main_quit();
gtk_widget_destroy(window);
return;
}
int main(int argc, char *argv[]){
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(swq), NULL);
gtk_widget_show(window);
gtk_main();
return 0;
}
I would like to know if the memory allocated to the Label Widget
"message" in function swq() will be freed in the end of the function.
If not, how can I free it? Is just to use the function
gtk_widget_destroy(message)?
What about the Dialog Widget "window"?
--
Lucas Clemente Vella
lvella triang com br
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]