From d6e309cac3804858878039f3283b2bcff24658a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 4 Jul 2001 17:22:12 +0000 Subject: Revert Sam's changes. 2001-07-04 Jeffrey Stedfast * mail-config.c (mail_config_set_show_preview): Revert Sam's changes. Note: Uhm, g_hash_table_lookup_extended gives us a pointer to the original value which we can just change to update the hash table without the need to re-insert - it's already there!! Also, you don't want to g_hash_table_insert the new value with the same key without at least first removing the existing bucket. And, you certainly don't want to g_free() the key after you insert it - eek!! svn path=/trunk/; revision=10780 --- mail/ChangeLog | 15 ++++++++++++++- mail/mail-config.c | 3 +-- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 495728fdd7..663f8cb6fe 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,9 +1,22 @@ +2001-07-04 Jeffrey Stedfast + + * mail-config.c (mail_config_set_show_preview): Revert Sam's changes. + + Note: Uhm, g_hash_table_lookup_extended gives us a pointer to the + original value which we can just change to update the hash table + without the need to re-insert - it's already there!! Also, you + don't want to g_hash_table_insert the new value with the same key + without at least first removing the existing bucket. And, you + certainly don't want to g_free() the key after you insert it - + eek!! + 2001-07-03 Sam Creasey + * mail-config.c (mail_config_set_show_preview): Replace value in config->preview_hash when it already exists. Old code never re-inserted into the hash, just assigned to val -- it's an int here, not a real pointer. - + 2001-07-03 Joe Shaw * mail-callbacks.c (expunge_folder): Unset the message being displayed diff --git a/mail/mail-config.c b/mail/mail-config.c index 28cbca3f17..6a60a4855e 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -923,8 +923,7 @@ mail_config_set_show_preview (const char *uri, gboolean value) config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); if (g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); + val = GINT_TO_POINTER (value); g_free (dbkey); } else { g_hash_table_insert (config->preview_hash, dbkey, -- cgit v1.2.3