r15041 - gnucash/trunk/src/core-utils - Correct gnc_gconf_add/remove_notification to avoid printf'ing NULL and

Andreas Köhler andi5 at cvs.gnucash.org
Wed Oct 18 17:08:27 EDT 2006


Author: andi5
Date: 2006-10-18 17:08:26 -0400 (Wed, 18 Oct 2006)
New Revision: 15041
Trac: http://svn.gnucash.org/trac/changeset/15041

Modified:
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
Log:
Correct gnc_gconf_add/remove_notification to avoid printf'ing NULL and
therefore crashes on Solaris and Windows. r14675 had fixed that, r14945
(me) undermined it though.


Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2006-10-18 19:45:12 UTC (rev 15040)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2006-10-18 21:08:26 UTC (rev 15041)
@@ -787,8 +787,8 @@
 	/*
 	 * Save the values needed to undo this later.
 	 */
-	client_tag = g_strdup_printf(CLIENT_TAG, section, whoami);
-	notify_tag = g_strdup_printf(NOTIFY_TAG, section, whoami);
+	client_tag = g_strdup_printf(CLIENT_TAG, section ? section:"", whoami);
+	notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section:"", whoami);
 	g_object_set_data(object, client_tag, client);
 	g_object_set_data(object, notify_tag, GUINT_TO_POINTER(id));
 	g_free(notify_tag);
@@ -858,11 +858,11 @@
 	/*
 	 * Remove any gconf notifications
 	 */
-	client_tag = g_strdup_printf(CLIENT_TAG, section, whoami);
+	client_tag = g_strdup_printf(CLIENT_TAG, section ? section:"", whoami);
 	client = g_object_get_data(object, client_tag);
 	path = gnc_gconf_section_name(section);
 	if (client) {
-	  notify_tag = g_strdup_printf(NOTIFY_TAG, section, whoami);
+	  notify_tag = g_strdup_printf(NOTIFY_TAG, section ? section:"", whoami);
 	  id = GPOINTER_TO_UINT(g_object_get_data(object, notify_tag));
 	  gconf_client_notify_remove(client, id);
 	  gconf_client_remove_dir(client, path, NULL);



More information about the gnucash-changes mailing list