From 5818e4c241dec1a0846e83820c50c9c50a003d76 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 17 Jul 2013 09:49:34 +0200 Subject: 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 file changed, 18 insertions(+), 1 deletion(-) diff --git a/e-util/e-contact-store.c b/e-util/e-contact-store.c index 6d2adc067f..8e34c20546 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, -- cgit v1.2.3