gnumeric r16926 - in trunk: . src



Author: mortenw
Date: Sat Oct 25 14:32:15 2008
New Revision: 16926
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16926&view=rev

Log:
2008-10-25  Morten Welinder  <terra gnome org>

	* src/main-application.c (main): Close all displays on exit.

	* src/gnumeric-gconf.c (gnm_conf_shutdown): Free more, zero whole
	prefs, NULL gnm_app_prefs.



Modified:
   trunk/ChangeLog
   trunk/src/gnumeric-gconf.c
   trunk/src/main-application.c

Modified: trunk/src/gnumeric-gconf.c
==============================================================================
--- trunk/src/gnumeric-gconf.c	(original)
+++ trunk/src/gnumeric-gconf.c	Sat Oct 25 14:32:15 2008
@@ -37,6 +37,7 @@
 #include <goffice/utils/go-locale.h>
 #include <value.h>
 #include <number-match.h>
+#include <string.h>
 
 static GnmAppPrefs prefs;
 GnmAppPrefs const *gnm_app_prefs = &prefs;
@@ -373,28 +374,35 @@
 void
 gnm_conf_shutdown (void)
 {
-	if (prefs.printer_decoration_font) {
+	if (prefs.printer_decoration_font)
 		gnm_style_unref (prefs.printer_decoration_font);
-		prefs.printer_decoration_font = NULL;
-	}
+
 	g_hash_table_destroy (prefs.toolbars);
 	g_hash_table_destroy (prefs.toolbar_positions);
 
 	go_slist_free_custom ((GSList *)prefs.plugin_file_states,
 			      (GFreeFunc)g_free);
-	prefs.plugin_file_states = NULL;
 
-	if (prefs.print_settings != NULL) {
+	if (prefs.print_settings != NULL)
 		g_object_unref (prefs.print_settings);
-		prefs.print_settings = NULL;
-	}
-	if (prefs.page_setup != NULL) {
+
+	if (prefs.page_setup != NULL)
 		g_object_unref (prefs.page_setup);
-		prefs.page_setup = NULL;
-	}
 
+	/* the const in the header is just a safety net */
+	g_free ((char *) prefs.default_font.name);
+
+	/* the const_cast is ok, the const in the header is just to keep
+	 * people for doing stupid things */
+	go_slist_free_custom ((GSList *)prefs.recent_funcs, g_free);
+
+	g_free (prefs.print_repeat_top);
+	g_free (prefs.print_repeat_left);
 
 	go_conf_free_node (root);
+
+	memset (&prefs, 0, sizeof (prefs));
+	gnm_app_prefs = NULL;
 }
 
 GOConfNode *

Modified: trunk/src/main-application.c
==============================================================================
--- trunk/src/main-application.c	(original)
+++ trunk/src/main-application.c	Sat Oct 25 14:32:15 2008
@@ -505,10 +505,16 @@
 
 	gnm_pre_parse_shutdown ();
 
+	/*
+	 * This helps finding leaks.  We might want it in developent
+	 * only.
+	 */
+	if (with_gui && (GNM_VERSION_MAJOR & 1)) {
+		GSList *displays = gdk_display_manager_list_displays
+			(gdk_display_manager_get ());
+		g_slist_foreach (displays, (GFunc)gdk_display_close, NULL);
+		g_slist_free (displays);
+	}
+
 	return 0;
 }
-
-#if 0
-/* A handy way of telling valgrind to produce good leak reports.  */
-gboolean g_module_close (GModule *module) { return FALSE; }
-#endif



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