[Gurlchecker-commits] r725 - trunk/src

esaracco at users.labs.libre-entreprise.org esaracco at users.labs.libre-entreprise.org
Sun Jan 24 09:30:04 CET 2010


Author: esaracco
Date: 2010-01-24 08:30:04 +0000 (Sun, 24 Jan 2010)
New Revision: 725

Modified:
   trunk/src/application.c
Log:
Fixed some GUI memory leaks.


Modified: trunk/src/application.c
===================================================================
--- trunk/src/application.c	2010-01-24 07:54:44 UTC (rev 724)
+++ trunk/src/application.c	2010-01-24 08:30:04 UTC (rev 725)
@@ -3059,7 +3059,7 @@
   pixbuf =
     gdk_pixbuf_new_from_file (UC_PIXMAPS_DIR "/gurlchecker_icon.png", NULL);
 
-  about_dialog = (GtkAboutDialog *) gtk_about_dialog_new ();
+  about_dialog = GTK_ABOUT_DIALOG (gtk_about_dialog_new ());
   gtk_about_dialog_set_version (about_dialog, UC_VERSION);
   gtk_about_dialog_set_copyright (about_dialog,
 				  "(C) 2002-2010 Emmanuel Saracco");
@@ -3099,13 +3099,13 @@
 				   const GtkMessageType msg_type)
 {
   gint ret = 0;
+  GtkWidget *dialog = NULL;
 
-  GtkWidget *dialog = gtk_message_dialog_new_with_markup (NULL,
-							  GTK_DIALOG_MODAL |
-							  GTK_DIALOG_DESTROY_WITH_PARENT,
-							  msg_type,
-							  GTK_BUTTONS_NONE,
-							  message);
+
+  dialog = gtk_message_dialog_new_with_markup (
+    NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, msg_type,
+    GTK_BUTTONS_NONE, message);
+
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
 			  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			  GTK_STOCK_NO, GTK_RESPONSE_NO,
@@ -3113,9 +3113,11 @@
 
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
   ret = gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_hide (dialog);
 
+  gtk_widget_destroy (dialog);
+
   return ret;
 }
 
@@ -3154,17 +3156,19 @@
 uc_application_dialog_show (const gchar * message,
 			    const GtkMessageType msg_type)
 {
-  GtkWidget *dialog = gtk_message_dialog_new_with_markup (NULL,
-							  GTK_DIALOG_MODAL |
-							  GTK_DIALOG_DESTROY_WITH_PARENT,
-							  msg_type,
-							  GTK_BUTTONS_OK,
-							  message);
+  GtkWidget *dialog = NULL;
 
+
+  dialog = gtk_message_dialog_new_with_markup (
+    NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, msg_type,
+    GTK_BUTTONS_OK, message);
+
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+
   gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_hide (dialog);
+
+  gtk_widget_destroy (dialog);
 }
 
 /**



More information about the Gurlchecker-commits mailing list