aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-mbox-summary.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-12-24 08:46:20 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-12-24 08:46:20 +0800
commit6de256c2a2b23f30d35e4a2213ad5839bf141d06 (patch)
treea34d8be64c0718070c4e1ea9548282912f37b387 /camel/providers/local/camel-mbox-summary.c
parent6183d89039ba67a7f3869f460c13aff09a548471 (diff)
downloadgsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.gz
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.bz2
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.lz
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.xz
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.zst
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.zip
Lock the command channel while searching. (imap_body_contains): If
2000-12-24 Not Zed <NotZed@HelixCode.com> * providers/imap/camel-imap-search.c (imap_body_contains): Lock the command channel while searching. (imap_body_contains): If performing a whole uid search, then add references to our own summary items, dont look it up in the folder. This way they can't vanish unexpectedly. * providers/imap/camel-imap-folder.h (CamelImapFolder): Added a private field. * providers/imap/camel-imap-private.h: Added lock for imap searches. * Merge from camel-mt-branch. * providers/imap/camel-imap-folder.c (imap_update_summary): Merge fix, use the folder->summary. (imap_get_message_flags, imap_set_message_flags, imap_get_message_user_flag, imap_set_message_user_flag): Removed again. (camel_imap_folder_init): Setup private data/lock. (imap_finalize): Free private data/search lock. (imap_search_free): Lock the search_lock. (imap_search_by_expression): Lock the search lock when using the search object. Also copy/ref hte summary, rather than getting it directly. (imap_refresh_info): Free any info lookups. Use folder->summary not imap_folder->summary. And lock around commands. svn path=/trunk/; revision=7150
Diffstat (limited to 'camel/providers/local/camel-mbox-summary.c')
-rw-r--r--camel/providers/local/camel-mbox-summary.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 2dde67b70c..5b62743857 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -306,6 +306,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
CamelMessageInfo *mi = camel_folder_summary_index(s, i);
camel_folder_change_info_add_source(changeinfo, camel_message_info_uid(mi));
+ camel_folder_summary_info_free(s, mi);
}
}
@@ -318,6 +319,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
for (i = 0; i < count; i++) {
CamelMessageInfo *mi = camel_folder_summary_index(s, i);
camel_folder_change_info_add_update(changeinfo, camel_message_info_uid(mi));
+ camel_folder_summary_info_free(s, mi);
}
camel_folder_change_info_build_diff(changeinfo);
}
@@ -459,7 +461,7 @@ mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChan
CamelFolderSummary *s = (CamelFolderSummary *)mbs;
CamelMimeParser *mp = NULL;
int i, count;
- CamelMboxMessageInfo *info;
+ CamelMboxMessageInfo *info = NULL;
int fd = -1, fdout = -1;
char *tmpname = NULL;
char *buffer, *xevnew = NULL;
@@ -533,6 +535,7 @@ mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChan
/* remove it from the change list */
camel_folder_change_info_remove_uid(changeinfo, uid);
camel_folder_summary_remove(s, (CamelMessageInfo *)info);
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
count--;
i--;
info = NULL;
@@ -584,6 +587,8 @@ mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChan
d(printf("we are now at %d, from = %d\n", (int)camel_mime_parser_tell(mp),
(int)camel_mime_parser_tell_start_from(mp)));
camel_mime_parser_unstep(mp);
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ info = NULL;
}
}
@@ -634,6 +639,8 @@ mbox_summary_sync_full(CamelLocalSummary *cls, gboolean expunge, CamelFolderChan
unlink(tmpname);
if (mp)
camel_object_unref((CamelObject *)mp);
+ if (info)
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
return -1;
}
@@ -646,7 +653,7 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha
CamelFolderSummary *s = (CamelFolderSummary *)mbs;
CamelMimeParser *mp = NULL;
int i, count;
- CamelMboxMessageInfo *info;
+ CamelMboxMessageInfo *info = NULL;
int fd = -1;
char *xevnew, *xevtmp;
const char *xev;
@@ -678,8 +685,11 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha
d(printf("Checking message %s %08x\n", info->info.uid, info->info.flags));
- if ((info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0)
+ if ((info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ info = NULL;
continue;
+ }
d(printf("Updating message %s\n", info->info.uid));
@@ -738,6 +748,7 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha
camel_mime_parser_drop_step(mp);
info->info.flags &= 0xffff;
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
}
d(printf("Closing folders\n"));
@@ -757,9 +768,10 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha
error:
if (fd != -1)
close(fd);
-
if (mp)
camel_object_unref((CamelObject *)mp);
+ if (info)
+ camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
return -1;
}
@@ -792,6 +804,7 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
quick = FALSE;
else
work |= (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
+ camel_folder_summary_info_free(s, info);
}
/* yuck i hate this logic, but its to simplify the 'all ok, update summary' and failover cases */