--- Begin Message ---
Author: hampton
Date: 2006-08-15 01:11:07 -0400 (Tue, 15 Aug 2006)
New Revision: 14675
Trac: http://svn.gnucash.org/trac/changeset/14675
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/core-utils/gnc-gconf-utils.c
gnucash/trunk/src/core-utils/gnc-gconf-utils.h
gnucash/trunk/src/gnome-utils/dialog-preferences.c
gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c
gnucash/trunk/src/gnome-utils/gnc-main-window.c
gnucash/trunk/src/gnome-utils/gnc-plugin.c
gnucash/trunk/src/gnome-utils/gnc-plugin.h
gnucash/trunk/src/gnome-utils/gnc-tree-view.c
Log:
Remove overloading of an argument passed to the
gnc_gconf_add/remove_notification functions.. This will solve a crash
on Solaris caused by g_vasprintf being passed a "%s" format string and
a NULL as argument. BP
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-08-15 04:13:46 UTC (rev 14674)
+++ gnucash/trunk/ChangeLog 2006-08-15 05:11:07 UTC (rev 14675)
@@ -1,3 +1,16 @@
+2006-08-15 David Hampton <[EMAIL PROTECTED]>
+
+ * src/core-utils/gnc-gconf-utils.[ch]:
+ * src/gnome-utils/dialog-preferences.c:
+ * src/gnome-utils/gnc-plugin.[ch]:
+ * src/gnome-utils/gnc-main-window.c:
+ * src/gnome-utils/dialog-reset-warnings.c:
+ * src/gnome-utils/gnc-tree-view.c: Remove overloading of an
+ argument passed to the gnc_gconf_add/remove_notification
+ functions.. This will solve a crash on Solaris caused by
+ g_vasprintf being passed a "%s" format string and a NULL as
+ argument.
+
2006-08-14 David Hampton <[EMAIL PROTECTED]>
* doc/tip_of_the_day.list.in: Add a tip for raising the accounts
Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c 2006-08-15 04:13:46 UTC
(rev 14674)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c 2006-08-15 05:11:07 UTC
(rev 14675)
@@ -743,7 +743,8 @@
void
gnc_gconf_add_notification (GObject *object,
const gchar *section,
- GConfClientNotifyFunc callback)
+ GConfClientNotifyFunc callback,
+ const gchar *whoami)
{
GConfClient *client;
GError *error = NULL;
@@ -752,6 +753,7 @@
g_return_if_fail(G_IS_OBJECT(object));
g_return_if_fail(callback != NULL);
+ g_return_if_fail(whoami != NULL);
client = gconf_client_get_default();
path = gnc_gconf_section_name(section);
@@ -785,8 +787,8 @@
/*
* Save the values needed to undo this later.
*/
- client_tag = g_strdup_printf(CLIENT_TAG, section);
- notify_tag = g_strdup_printf(NOTIFY_TAG, section);
+ client_tag = g_strdup_printf(CLIENT_TAG, whoami);
+ notify_tag = g_strdup_printf(NOTIFY_TAG, whoami);
g_object_set_data(object, client_tag, client);
g_object_set_data(object, notify_tag, GUINT_TO_POINTER(id));
g_free(notify_tag);
@@ -843,22 +845,24 @@
void
gnc_gconf_remove_notification (GObject *object,
- const gchar *section)
+ const gchar *section,
+ const gchar *whoami)
{
GConfClient *client;
gchar *path, *client_tag, *notify_tag;
guint id;
g_return_if_fail(G_IS_OBJECT(object));
+ g_return_if_fail(whoami != NULL);
/*
* Remove any gconf notifications
*/
- client_tag = g_strdup_printf(CLIENT_TAG, section);
+ client_tag = g_strdup_printf(CLIENT_TAG, 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);
+ notify_tag = g_strdup_printf(NOTIFY_TAG, 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);
Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.h 2006-08-15 04:13:46 UTC
(rev 14674)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.h 2006-08-15 05:11:07 UTC
(rev 14675)
@@ -765,10 +765,15 @@
* @param callback The function to call when a value changes. This
* function will receive the key/value pair as one argument, and the
* 'object' argument to this function as another of its arguments.
+ *
+ * @param whoami A magic value that must match up this call to the
+ * corresponding call to gnc_gconf_remove_notification(). This value
+ * should be unique across all callers.
*/
void gnc_gconf_add_notification (GObject *object,
const gchar *section,
- GConfClientNotifyFunc callback);
+ GConfClientNotifyFunc callback,
+ const gchar *whoami);
/** An alternative function for adding a notification callback to
@@ -820,9 +825,14 @@
*
* @param section This string is used to find the correct
* notification function to remove from GConf.
+ *
+ * @param whoami A magic value that must match up this call to the
+ * corresponding call to gnc_gconf_add_notification(). This value
+ * should be unique across all callers.
*/
void gnc_gconf_remove_notification (GObject *object,
- const gchar *section);
+ const gchar *section,
+ const gchar *whoami);
Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c 2006-08-15 04:13:46 UTC
(rev 14674)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c 2006-08-15 05:11:07 UTC
(rev 14675)
@@ -1264,7 +1264,8 @@
gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
gnc_unregister_gui_component_by_data(DIALOG_PREFERENCES_CM_CLASS,
dialog);
- gnc_gconf_remove_notification(G_OBJECT(dialog), NULL);
+ gnc_gconf_remove_notification(G_OBJECT(dialog), NULL,
+ DIALOG_PREFERENCES_CM_CLASS);
gtk_widget_destroy(GTK_WIDGET(dialog));
break;
}
@@ -1614,7 +1615,8 @@
gtk_widget_show(dialog);
gnc_gconf_add_notification(G_OBJECT(dialog), NULL,
- gnc_preferences_gconf_changed);
+ gnc_preferences_gconf_changed,
+ DIALOG_PREFERENCES_CM_CLASS);
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
(GncGconfGeneralCb)gnc_account_separator_prefs_cb,
dialog);
Modified: gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c 2006-08-15
04:13:46 UTC (rev 14674)
+++ gnucash/trunk/src/gnome-utils/dialog-reset-warnings.c 2006-08-15
05:11:07 UTC (rev 14675)
@@ -221,7 +221,8 @@
break;
case GTK_RESPONSE_OK:
- gnc_gconf_remove_notification(G_OBJECT(dialog), GCONF_WARNINGS);
+ gnc_gconf_remove_notification(G_OBJECT(dialog), GCONF_WARNINGS,
+ DIALOG_RESET_WARNINGS_CM_CLASS);
gnc_reset_warnings_apply_changes(dialog);
gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
@@ -230,7 +231,8 @@
break;
default:
- gnc_gconf_remove_notification(G_OBJECT(dialog), GCONF_WARNINGS);
+ gnc_gconf_remove_notification(G_OBJECT(dialog), GCONF_WARNINGS,
+ DIALOG_RESET_WARNINGS_CM_CLASS);
gnc_reset_warnings_revert_changes(dialog);
gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
dialog);
@@ -415,7 +417,8 @@
gnc_reset_warnings_update_widgets(dialog);
gnc_gconf_add_notification(G_OBJECT(dialog), GCONF_WARNINGS,
- gnc_reset_warnings_gconf_changed);
+ gnc_reset_warnings_gconf_changed,
+ DIALOG_RESET_WARNINGS_CM_CLASS);
gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-08-15 04:13:46 UTC
(rev 14674)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-08-15 05:11:07 UTC
(rev 14675)
@@ -1827,8 +1827,10 @@
/* Update the "Windows" menu in all other windows */
gnc_main_window_update_all_menu_items();
- gnc_gconf_remove_notification(G_OBJECT(window),
DESKTOP_GNOME_INTERFACE);
- gnc_gconf_remove_notification(G_OBJECT(window), GCONF_GENERAL);
+ gnc_gconf_remove_notification(G_OBJECT(window),
DESKTOP_GNOME_INTERFACE,
+ GNC_MAIN_WINDOW_NAME);
+ gnc_gconf_remove_notification(G_OBJECT(window), GCONF_GENERAL,
+ GNC_MAIN_WINDOW_NAME);
qof_event_unregister_handler(priv->event_handler_id);
priv->event_handler_id = 0;
@@ -2734,9 +2736,11 @@
g_free(filename);
gnc_gconf_add_notification(G_OBJECT(window), GCONF_GENERAL,
- gnc_main_window_gconf_changed);
+ gnc_main_window_gconf_changed,
+ GNC_MAIN_WINDOW_NAME);
gnc_gconf_add_notification(G_OBJECT(window), DESKTOP_GNOME_INTERFACE,
- gnc_main_window_gconf_changed);
+ gnc_main_window_gconf_changed,
+ GNC_MAIN_WINDOW_NAME);
gnc_main_window_update_toolbar(window);
gnc_main_window_update_tab_position(window);
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin.c 2006-08-15 04:13:46 UTC (rev
14674)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin.c 2006-08-15 05:11:07 UTC (rev
14675)
@@ -85,7 +85,7 @@
};
gnc_plugin_type = g_type_register_static (G_TYPE_OBJECT,
- "GncPlugin",
+ GNC_PLUGIN_NAME,
&our_info, 0);
}
@@ -195,7 +195,7 @@
if (class->gconf_section && class->gconf_notifications) {
DEBUG ("Requesting notification for section %s",
class->gconf_section);
gnc_gconf_add_notification(G_OBJECT(window), class->gconf_section,
- class->gconf_notifications);
+ class->gconf_notifications,
GNC_PLUGIN_NAME);
}
/*
@@ -241,7 +241,8 @@
*/
if (class->gconf_section && class->gconf_notifications) {
DEBUG ("Remove notification for section %s", class->gconf_section);
- gnc_gconf_remove_notification (G_OBJECT(window),
class->gconf_section);
+ gnc_gconf_remove_notification (G_OBJECT(window), class->gconf_section,
+ GNC_PLUGIN_NAME);
}
/*
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin.h 2006-08-15 04:13:46 UTC (rev
14674)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin.h 2006-08-15 05:11:07 UTC (rev
14675)
@@ -93,6 +93,8 @@
#define GNC_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GNC_TYPE_PLUGIN))
#define GNC_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GNC_PLUGIN, GncPluginClass))
+#define GNC_PLUGIN_NAME "GncPlugin"
+
/* typedefs & structures */
/** The instance data structure for a menu-only plugin. */
Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view.c 2006-08-15 04:13:46 UTC
(rev 14674)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view.c 2006-08-15 05:11:07 UTC
(rev 14675)
@@ -1191,7 +1191,8 @@
}
DEBUG("removing gconf notification");
- gnc_gconf_remove_notification(G_OBJECT(view), priv->gconf_section);
+ gnc_gconf_remove_notification(G_OBJECT(view), priv->gconf_section,
+ GNC_TREE_VIEW_NAME);
g_free(priv->gconf_section);
priv->gconf_section = NULL;
LEAVE(" ");
@@ -1228,7 +1229,8 @@
priv = GNC_TREE_VIEW_GET_PRIVATE(view);
priv->gconf_section = g_strdup(section);
gnc_gconf_add_notification(G_OBJECT(view), section,
- gnc_tree_view_gconf_changed);
+ gnc_tree_view_gconf_changed,
+ GNC_TREE_VIEW_NAME);
/* Catch changes to the sort column. Propagate to gconf. The key can
* be set before the model, so the code must handle that case. */
_______________________________________________
gnucash-changes mailing list
[EMAIL PROTECTED]
https://lists.gnucash.org/mailman/listinfo/gnucash-changes
--- End Message ---