[evolution-data-server/openismus-work: 73/122] Fix lock of loaded modules in EDataBook



commit 7365dcd6204b0660eaf94fd9cff50c736594bdcc
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Nov 30 16:26:38 2012 +0900

    Fix lock of loaded modules in EDataBook
    
    This adjustment makes multiple threads racing to load modules
    all succeed, without it some threads fall back to non-direct read
    access mode.

 addressbook/libedata-book/e-data-book.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 29784b1..beab435 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -162,8 +162,6 @@ load_module (const gchar *module_path)
 {
 	EModule *module = NULL;
 
-	G_LOCK (modules_table);
-
 	if (!modules_table)
 		modules_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 
@@ -177,8 +175,6 @@ load_module (const gchar *module_path)
 			g_hash_table_insert (modules_table, g_strdup (module_path), module);
 	}
 
-	G_UNLOCK (modules_table);
-
 	return module;
 }
 
@@ -1788,6 +1784,8 @@ e_data_book_new_direct (ESourceRegistry *registry,
 	g_return_val_if_fail (backend_path && backend_path[0], NULL);
 	g_return_val_if_fail (backend_name && backend_name[0], NULL);
 
+	G_LOCK (modules_table);
+
 	module = load_module (backend_path);
 	if (!module)
 		goto new_direct_finish;
@@ -1821,6 +1819,8 @@ e_data_book_new_direct (ESourceRegistry *registry,
 
  new_direct_finish:
 
+	G_UNLOCK (modules_table);
+
 	return book;
 }
 



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