[evolution-data-server/gnome-3-8] Bug #704181 - Froze while filtering messages
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-8] Bug #704181 - Froze while filtering messages
- Date: Thu, 18 Jul 2013 16:55:27 +0000 (UTC)
commit 8bbf4596b18bdf241fbd36b333d80492932424c8
Author: Milan Crha <mcrha redhat com>
Date: Thu Jul 18 18:54:37 2013 +0200
Bug #704181 - Froze while filtering messages
camel/camel-folder.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index ce257c6..145d441 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -239,9 +239,13 @@ folder_emit_renamed_cb (gpointer user_data)
return FALSE;
}
-static void
-folder_filter_data_free (FolderFilterData *data)
+static gpointer
+folder_filter_data_free_thread (gpointer user_data)
{
+ FolderFilterData *data = user_data;
+
+ g_return_val_if_fail (data != NULL, NULL);
+
if (data->driver != NULL)
g_object_unref (data->driver);
if (data->recents != NULL)
@@ -258,6 +262,21 @@ folder_filter_data_free (FolderFilterData *data)
g_object_unref (data->folder);
g_slice_free (FolderFilterData, data);
+
+ return NULL;
+}
+
+static void
+prepare_folder_filter_data_free (FolderFilterData *data)
+{
+ GThread *thread;
+
+ /* Do the actual free in a dedicated thread, because the driver or
+ folder unref can do network/blocking I/O operations, but this
+ function is called in the main (UI) thread.
+ */
+ thread = g_thread_new (NULL, folder_filter_data_free_thread, data);
+ g_thread_unref (thread);
}
static void
@@ -1753,7 +1772,7 @@ folder_changed (CamelFolder *folder,
camel_session_submit_job (
session, (CamelSessionCallback) folder_filter,
- data, (GDestroyNotify) folder_filter_data_free);
+ data, (GDestroyNotify) prepare_folder_filter_data_free);
g_signal_stop_emission (folder, signals[CHANGED], 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]