Re: Patch: load summary on processing folder-tracking-changed
- From: José Dapena Paz <jdapena igalia com>
- To: Philip Van Hoof <spam pvanhoof be>
- Cc: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Re: Patch: load summary on processing folder-tracking-changed
- Date: Fri, 24 Jul 2009 15:38:18 +0200
El jue, 23-07-2009 a las 10:22 +0200, Philip Van Hoof escribió:
> On Tue, 2009-07-21 at 17:29 +0200, José Dapena Paz wrote:
>
> It looks like you missed a g_static_rec_mutex_unlock in case of success
Yes, it was wrong. Patch fixed is attached.
--
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index 9f9cddf..b6f0023 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-24 Jose Dapena Paz <jdapena igalia com>
+
+ * libtinymail-camel/tny-camel-folder.c (folder_tracking_changed):
+ reimplemented to load the summary when we get a folder changed
+ event from camel, and use the standard folder_changed handler.
+ Avoids crashes if the camel folder is freed earlier than
+ folder changed handling finishes.
+
2009-07-16 Sergio Villar Senin <svillar igalia com>
* libtinymail-camel/tny-camel-folder.c (folder_tracking_changed):
diff --git a/libtinymail-camel/tny-camel-folder.c b/libtinymail-camel/tny-camel-folder.c
index 2fe9015..e84e6b8 100644
--- a/libtinymail-camel/tny-camel-folder.c
+++ b/libtinymail-camel/tny-camel-folder.c
@@ -89,6 +89,8 @@ static GObjectClass *parent_class = NULL;
static void tny_camel_folder_transfer_msgs_shared (TnyFolder *self, TnyList *headers, TnyFolder *folder_dst, gboolean delete_originals, TnyList *new_headers, GError **err);
+static gboolean load_folder_no_lock (TnyCamelFolderPriv *priv);
+static void folder_changed (CamelFolder *camel_folder, CamelFolderChangeInfo *info, gpointer user_data);
@@ -338,34 +340,22 @@ folder_tracking_changed (CamelFolder *camel_folder, CamelFolderChangeInfo *info,
this notification will be received by folder_changed as
well. Checks for folder_changed_id and loaded are harmless
and unlikely needed */
- if (priv->folder && priv->folder_changed_id && priv->loaded)
- return;
-
- if (!priv->handle_changes)
+ g_static_rec_mutex_lock (priv->folder_lock);
+ if (priv->folder && priv->folder_changed_id && priv->loaded) {
+ g_static_rec_mutex_unlock (priv->folder_lock);
return;
+ }
- if (!g_static_rec_mutex_trylock (priv->folder_lock)) {
+ _tny_camel_folder_reason (priv);
+ if (!load_folder_no_lock (priv)) {
g_static_rec_mutex_unlock (priv->folder_lock);
return;
}
- /* Update message counts */
- priv->cached_length = (guint) camel_folder_get_message_count (camel_folder);
- priv->unread_length = (guint) camel_folder_get_unread_message_count (camel_folder);
- change = tny_folder_change_new (TNY_FOLDER (self));
-
- /* Update iter */
- update_iter_counts (priv);
+ folder_changed (camel_folder, info, priv);
+ _tny_camel_folder_unreason (priv);
g_static_rec_mutex_unlock (priv->folder_lock);
- tny_folder_change_set_new_unread_count (change, priv->unread_length);
- tny_folder_change_set_new_all_count (change, priv->cached_length);
- priv->dont_fkill = TRUE;
- notify_folder_observers_about_in_idle (TNY_FOLDER (self), change,
- TNY_FOLDER_PRIV_GET_SESSION (priv));
- g_object_unref (change);
- priv->dont_fkill = old;
-
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]