Make sure data-book/cal is closed/freed in a separate thread
authorMilan Crha <mcrha@redhat.com>
Thu, 10 May 2012 10:54:16 +0000 (12:54 +0200)
committerMilan Crha <mcrha@redhat.com>
Thu, 10 May 2012 10:54:16 +0000 (12:54 +0200)
When EDataBook/EDataCal was unreffed in the main thread then
any later calls to the factory were blocked by the backend
till it freed its resources, possibly making client look like
frozen/unresponsive.

addressbook/libedata-book/e-data-book.c
calendar/libedata-cal/e-data-cal.c

index 03d7506..095c9bd 100644 (file)
@@ -810,12 +810,12 @@ impl_Book_close (EGdbusBook *object,
        OperationData *op;
 
        op = op_new (OP_CLOSE, book);
+       /* unref here makes sure the book is freed in a separate thread */
+       g_object_unref (book);
 
        e_gdbus_book_complete_close (book->priv->gdbus_object, invocation, NULL);
        e_operation_pool_push (ops_pool, op);
 
-       g_object_unref (book);
-
        return TRUE;
 }
 
index e3123cd..40e294d 100644 (file)
@@ -915,12 +915,12 @@ impl_Cal_close (EGdbusCal *object,
        OperationData *op;
 
        op = op_new (OP_CLOSE, cal);
+       /* unref here makes sure the cal is freed in a separate thread */
+       g_object_unref (cal);
 
        e_gdbus_cal_complete_close (cal->priv->gdbus_object, invocation, NULL);
        e_operation_pool_push (ops_pool, op);
 
-       g_object_unref (cal);
-
        return TRUE;
 }