[evolution-data-server] Lock the CamelStoreSummary before invoking store_info_set_string().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Lock the CamelStoreSummary before invoking store_info_set_string().
- Date: Fri, 16 Aug 2013 19:43:35 +0000 (UTC)
commit 770e06684531aeff87c365dbba09969689e378ed
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Aug 16 15:28:12 2013 -0400
Lock the CamelStoreSummary before invoking store_info_set_string().
Not the best approach since we're invoking unknown code with a mutex
locked, but beats the hell out of exposing the mutex in the public API.
camel/camel-imapx-store-summary.c | 2 --
camel/camel-store-summary.c | 6 ++++--
camel/providers/nntp/camel-nntp-store-summary.c | 2 --
3 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-imapx-store-summary.c b/camel/camel-imapx-store-summary.c
index d921fb2..a65af60 100644
--- a/camel/camel-imapx-store-summary.c
+++ b/camel/camel-imapx-store-summary.c
@@ -638,10 +638,8 @@ store_info_set_string (CamelStoreSummary *s,
switch (type) {
case CAMEL_IMAPX_STORE_INFO_FULL_NAME:
d ("Set full name %s -> %s\n", isi->full_name, str);
- camel_store_summary_lock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
g_free (isi->full_name);
isi->full_name = g_strdup (str);
- camel_store_summary_unlock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
break;
default:
store_summary_class->store_info_set_string (s, mi, type, str);
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index d4c2d1a..ae316d1 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -248,13 +248,11 @@ store_summary_store_info_set_string (CamelStoreSummary *summary,
{
switch (type) {
case CAMEL_STORE_INFO_PATH:
- camel_store_summary_lock (summary, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
g_hash_table_remove (summary->folders_path, (gchar *) camel_store_info_path (summary, info));
g_free (info->path);
info->path = g_strdup (str);
g_hash_table_insert (summary->folders_path, (gchar *) camel_store_info_path (summary, info),
info);
summary->flags |= CAMEL_STORE_SUMMARY_DIRTY;
- camel_store_summary_unlock (summary, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
break;
}
}
@@ -823,7 +821,11 @@ camel_store_info_set_string (CamelStoreSummary *summary,
class = CAMEL_STORE_SUMMARY_GET_CLASS (summary);
g_return_if_fail (class->store_info_set_string != NULL);
+ g_rec_mutex_lock (&summary->priv->summary_lock);
+
class->store_info_set_string (summary, info, type, value);
+
+ g_rec_mutex_unlock (&summary->priv->summary_unlock);
}
/**
diff --git a/camel/providers/nntp/camel-nntp-store-summary.c b/camel/providers/nntp/camel-nntp-store-summary.c
index cbf0548..a04291f 100644
--- a/camel/providers/nntp/camel-nntp-store-summary.c
+++ b/camel/providers/nntp/camel-nntp-store-summary.c
@@ -385,10 +385,8 @@ store_info_set_string (CamelStoreSummary *s,
switch (type) {
case CAMEL_NNTP_STORE_INFO_FULL_NAME:
d (printf ("Set full name %s -> %s\n", nsi->full_name, str));
- camel_store_summary_lock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
g_free (nsi->full_name);
nsi->full_name = g_strdup (str);
- camel_store_summary_unlock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
break;
default:
CAMEL_STORE_SUMMARY_CLASS (camel_nntp_store_summary_parent_class)->store_info_set_string (s,
mi, type, str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]