[evolution-data-server] Bug #574940 - Always ref returned info from message_info_from_uid
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #574940 - Always ref returned info from message_info_from_uid
- Date: Mon, 15 Feb 2010 16:06:49 +0000 (UTC)
commit 4299e16b3356da0a752d5ae5ccaf1c981c467e5d
Author: Milan Crha <mcrha redhat com>
Date: Mon Feb 15 17:05:26 2010 +0100
Bug #574940 - Always ref returned info from message_info_from_uid
camel/camel-folder-summary.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 96574a7..49586e0 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -541,7 +541,6 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
gint ret;
CAMEL_SUMMARY_LOCK(s, summary_lock);
- CAMEL_SUMMARY_LOCK(s, ref_lock);
info = g_hash_table_lookup (s->loaded_infos, uid);
@@ -558,7 +557,6 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
folder_name = s->folder->full_name;
cdb = s->folder->parent_store->cdb_r;
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
data.summary = s;
@@ -572,7 +570,6 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
}
CAMEL_SUMMARY_LOCK(s, summary_lock);
- CAMEL_SUMMARY_LOCK(s, ref_lock);
/* We would have double reffed at camel_read_mir_callback */
info = g_hash_table_lookup (s->loaded_infos, uid);
@@ -586,10 +583,11 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
camel_exception_clear (&ex);
g_free (errmsg);
}
- } else
- info->refcount++;
+ }
+
+ if (info)
+ camel_message_info_ref (info);
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
CAMEL_SUMMARY_UNLOCK(s, summary_lock);
return info;
@@ -2348,11 +2346,12 @@ summary_remove_uid (CamelFolderSummary *s, const gchar *uid)
void
camel_folder_summary_remove (CamelFolderSummary *s, CamelMessageInfo *info)
{
-
+ gboolean found;
gint ret;
CAMEL_SUMMARY_LOCK(s, summary_lock);
+ found = g_hash_table_lookup (s->loaded_infos, camel_message_info_uid (info)) != NULL;
g_hash_table_remove (s->loaded_infos, camel_message_info_uid(info));
ret = summary_remove_uid (s, camel_message_info_uid(info));
@@ -2363,7 +2362,8 @@ camel_folder_summary_remove (CamelFolderSummary *s, CamelMessageInfo *info)
if (!ret && camel_db_delete_uid (s->folder->parent_store->cdb_w, s->folder->full_name, camel_message_info_uid(info), NULL) != 0)
return;
- camel_message_info_free(info);
+ if (found)
+ camel_message_info_free (info);
}
/**
@@ -3497,7 +3497,7 @@ message_info_free(CamelFolderSummary *s, CamelMessageInfo *info)
CamelMessageInfoBase *mi = (CamelMessageInfoBase *)info;
if (mi->uid) {
- if (g_hash_table_lookup (s->loaded_infos, mi->uid) == mi) {
+ if (s && g_hash_table_lookup (s->loaded_infos, mi->uid) == mi) {
g_hash_table_remove (s->loaded_infos, mi->uid);
}
camel_pstring_free(mi->uid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]