aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-07-28 15:25:28 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-07-28 15:25:28 +0800
commitc5f7464467beeb50c932b5ee1392951103b28ac8 (patch)
tree86a394bf6b99d0f01e83c0d2e20bb6ea53342746
parentcd2440f430c449200f36bb73cc2e14b5d2ed9585 (diff)
downloadgsoc2013-evolution-c5f7464467beeb50c932b5ee1392951103b28ac8.tar.gz
gsoc2013-evolution-c5f7464467beeb50c932b5ee1392951103b28ac8.tar.zst
gsoc2013-evolution-c5f7464467beeb50c932b5ee1392951103b28ac8.zip
** Fix for bug #530388
2008-07-28 Milan Crha <mcrha@redhat.com> ** Fix for bug #530388 * filter-label.c: (filter_label_init), (filter_label_finalise), (fill_options), (filter_label_count), (filter_label_label), (filter_label_index): Make 'cache_lock' a rec mutex. * filter-label.c: (regen_label_options): Guard also regeneration of each tracked item with the rec lock, thus noone will touch 'tracked_filters' GSList until we are fully done with it. svn path=/trunk/; revision=35849
-rw-r--r--filter/ChangeLog11
-rw-r--r--filter/filter-label.c33
2 files changed, 28 insertions, 16 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 1e713d561e..5eacc51aee 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,14 @@
+2008-07-28 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #530388
+
+ * filter-label.c: (filter_label_init), (filter_label_finalise),
+ (fill_options), (filter_label_count), (filter_label_label),
+ (filter_label_index): Make 'cache_lock' a rec mutex.
+ * filter-label.c: (regen_label_options): Guard also regeneration
+ of each tracked item with the rec lock, thus noone will touch
+ 'tracked_filters' GSList until we are fully done with it.
+
2008-07-03 Milan Crha <mcrha@redhat.com>
** Fix for bug #243201
diff --git a/filter/filter-label.c b/filter/filter-label.c
index 90906e8ba1..7291e36b4c 100644
--- a/filter/filter-label.c
+++ b/filter/filter-label.c
@@ -74,7 +74,7 @@ filter_label_get_type (void)
return type;
}
-static GStaticMutex cache_lock = G_STATIC_MUTEX_INIT;
+static GStaticRecMutex cache_lock = G_STATIC_REC_MUTEX_INIT;
static guint cache_notifier_id = 0;
static GSList *tracked_filters = NULL;
static GSList *labels_cache = NULL;
@@ -103,7 +103,7 @@ filter_label_init (FilterLabel *fl)
{
((FilterOption *) fl)->type = "label";
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
if (!tracked_filters) {
fill_cache ();
@@ -115,7 +115,7 @@ filter_label_init (FilterLabel *fl)
tracked_filters = g_slist_prepend (tracked_filters, fl);
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
}
static void
@@ -123,7 +123,7 @@ filter_label_finalise (GObject *obj)
{
G_OBJECT_CLASS (parent_class)->finalize (obj);
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
tracked_filters = g_slist_remove (tracked_filters, obj);
@@ -138,7 +138,7 @@ filter_label_finalise (GObject *obj)
gconf_client = NULL;
}
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
}
/**
@@ -176,7 +176,7 @@ fill_options (FilterOption *fo)
{
GSList *l;
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
for (l = labels_cache; l; l = l->next) {
EUtilLabel *label = l->data;
@@ -197,7 +197,7 @@ fill_options (FilterOption *fo)
g_free (title);
}
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
}
static void
@@ -222,12 +222,13 @@ regen_label_options (FilterOption *fo)
static void
gconf_labels_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
{
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
+
clear_cache ();
fill_cache ();
- g_static_mutex_unlock (&cache_lock);
-
g_slist_foreach (tracked_filters, (GFunc)regen_label_options, NULL);
+
+ g_static_rec_mutex_unlock (&cache_lock);
}
/* ************************************************************************* */
@@ -237,11 +238,11 @@ filter_label_count (void)
{
int res;
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
res = g_slist_length (labels_cache);
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
return res;
}
@@ -253,7 +254,7 @@ filter_label_label (int i)
GSList *l;
EUtilLabel *label;
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
l = g_slist_nth (labels_cache, i);
@@ -269,7 +270,7 @@ filter_label_label (int i)
res = label->tag;
}
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
return res;
}
@@ -280,7 +281,7 @@ filter_label_index (const char *label)
int i;
GSList *l;
- g_static_mutex_lock (&cache_lock);
+ g_static_rec_mutex_lock (&cache_lock);
for (i = 0, l = labels_cache; l; i++, l = l->next) {
EUtilLabel *lbl = l->data;
@@ -293,7 +294,7 @@ filter_label_index (const char *label)
break;
}
- g_static_mutex_unlock (&cache_lock);
+ g_static_rec_mutex_unlock (&cache_lock);
if (l)
return i;