[evolution/gnome-3-8] EContactStore: Stop book views in a dedicated thread



commit fdf5ef898315a7ca3e2543b42e9c2f81fdc6b86f
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 17 09:49:34 2013 +0200

    EContactStore: Stop book views in a dedicated thread
    
    I've got UI freeze in a call of e_book_client_view_stop() on contact
    store dispose, caused by synchronous D-Bus call. Doing the call
    in a dedicated thread makes no UI freeze here.

 e-util/e-contact-store.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-contact-store.c b/e-util/e-contact-store.c
index 6d2adc0..8e34c20 100644
--- a/e-util/e-contact-store.c
+++ b/e-util/e-contact-store.c
@@ -717,6 +717,20 @@ view_complete (EContactStore *contact_store,
  * View/Query management *
  * --------------------- */
 
+static gpointer
+contact_store_stop_view_in_thread (gpointer user_data)
+{
+       EBookClientView *view = user_data;
+
+       g_return_val_if_fail (E_IS_BOOK_CLIENT_VIEW (view), NULL);
+
+       /* this does blocking D-Bus call, thus do it in a dedicated thread */
+       e_book_client_view_stop (view, NULL);
+       g_object_unref (view);
+
+       return NULL;
+}
+
 static void
 start_view (EContactStore *contact_store,
             EBookClientView *view)
@@ -743,7 +757,10 @@ static void
 stop_view (EContactStore *contact_store,
            EBookClientView *view)
 {
-       e_book_client_view_stop (view, NULL);
+       GThread *thread;
+
+       thread = g_thread_new (NULL, contact_store_stop_view_in_thread, g_object_ref (view));
+       g_thread_unref (thread);
 
        g_signal_handlers_disconnect_matched (
                view, G_SIGNAL_MATCH_DATA,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]