From: Colin Leroy Date: Sat, 13 Jan 2007 13:25:08 +0000 (+0000) Subject: 2007-01-13 [colin] 2.7.0cvs19 X-Git-Tag: rel_2_8_0~152 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=6cdab356ed662f68434329a0caac0e185e3d32dd 2007-01-13 [colin] 2.7.0cvs19 * src/etpan/imap-thread.c Make sure we don't free the same imap twice --- diff --git a/ChangeLog b/ChangeLog index 9dd29005c..49cb99382 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-13 [colin] 2.7.0cvs19 + + * src/etpan/imap-thread.c + Make sure we don't free the same imap + twice + 2007-01-13 [colin] 2.7.0cvs18 * commitHelper diff --git a/PATCHSETS b/PATCHSETS index 105eba9cd..0e60f781a 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2245,3 +2245,4 @@ ( cvs diff -u -r 1.382.2.350 -r 1.382.2.351 src/compose.c; ) > 2.7.0cvs16.patchset ( cvs diff -u -r 1.1.4.63 -r 1.1.4.64 src/etpan/imap-thread.c; ) > 2.7.0cvs17.patchset ( cvs diff -u -r 1.1.2.33 -r 1.1.2.34 commitHelper; ) > 2.7.0cvs18.patchset +( cvs diff -u -r 1.1.4.64 -r 1.1.4.65 src/etpan/imap-thread.c; ) > 2.7.0cvs19.patchset diff --git a/configure.ac b/configure.ac index 4f810933d..63acaa54f 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=7 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=18 +EXTRA_VERSION=19 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c index b1299010f..7726100f0 100644 --- a/src/etpan/imap-thread.c +++ b/src/etpan/imap-thread.c @@ -31,6 +31,23 @@ static chash * session_hash = NULL; static guint thread_manager_signal = 0; static GIOChannel * io_channel = NULL; +void delete_imap(Folder *folder, mailimap *imap) +{ + chashdatum key; + chashdatum value; + + key.data = &folder; + key.len = sizeof(folder); + value.data = imap; + value.len = 0; + chash_delete(session_hash, &key, NULL); + + key.data = &imap; + key.len = sizeof(imap); + chash_delete(courier_workaround_hash, &key, NULL); + debug_print("removing mailimap %p\n", imap); + mailimap_free(imap); +} static gboolean thread_manager_event(GIOChannel * source, GIOCondition condition, @@ -417,13 +434,8 @@ int imap_threaded_connect(Folder * folder, const char * server, int port) imap = get_imap(folder); if (imap) { - key.data = &folder; - key.len = sizeof(folder); - value.data = imap; - value.len = 0; - chash_delete(session_hash, &key, NULL); - mailimap_free(imap); - debug_print("deleted old imap\n"); + debug_print("deleting old imap %p\n", imap); + delete_imap(folder, imap); } imap = mailimap_new(0, NULL); @@ -501,13 +513,8 @@ int imap_threaded_connect_ssl(Folder * folder, const char * server, int port) imap = get_imap(folder); if (imap) { - key.data = &folder; - key.len = sizeof(folder); - value.data = imap; - value.len = 0; - chash_delete(session_hash, &key, NULL); - mailimap_free(imap); - debug_print("deleted old imap\n"); + debug_print("deleting old imap %p\n", imap); + delete_imap(folder, imap); } imap = mailimap_new(0, NULL); @@ -615,8 +622,6 @@ void imap_threaded_disconnect(Folder * folder) { struct connect_param param; struct connect_result result; - chashdatum key; - chashdatum value; mailimap * imap; imap = get_imap(folder); @@ -629,17 +634,12 @@ void imap_threaded_disconnect(Folder * folder) threaded_run(folder, ¶m, &result, disconnect_run); - key.data = &folder; - key.len = sizeof(folder); - value.data = imap; - value.len = 0; - chash_delete(session_hash, &key, NULL); - - key.data = &imap; - key.len = sizeof(imap); - chash_delete(courier_workaround_hash, &key, NULL); - - mailimap_free(imap); + if (imap == get_imap(folder)) { + debug_print("deleting old imap %p\n", imap); + delete_imap(folder, imap); + } else { + debug_print("imap already deleted %p\n", imap); + } debug_print("disconnect ok\n"); } @@ -2730,13 +2730,8 @@ int imap_threaded_connect_cmd(Folder * folder, const char * command, imap = get_imap(folder); if (imap) { - key.data = &folder; - key.len = sizeof(folder); - value.data = imap; - value.len = 0; - chash_delete(session_hash, &key, NULL); - mailimap_free(imap); - debug_print("deleted old imap\n"); + debug_print("deleting old imap %p\n", imap); + delete_imap(folder, imap); } imap = mailimap_new(0, NULL);