diff options
author | Dan Winship <danw@gnome.org> | 2011-10-12 13:57:44 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2011-10-12 13:57:44 -0400 |
commit | 95cab96515d84a9bc5dd731ea6eee08d7e786f50 (patch) | |
tree | 708dc70ddadbc15622becdab4d8eeae2134e9c44 /gio/giomodule.c | |
parent | 71cf70b39cd3859ac4cb4954c369bda731a61171 (diff) | |
download | glib-95cab96515d84a9bc5dd731ea6eee08d7e786f50.tar.gz glib-95cab96515d84a9bc5dd731ea6eee08d7e786f50.tar.bz2 glib-95cab96515d84a9bc5dd731ea6eee08d7e786f50.zip |
giomodule: make the default_modules mutex recursive
It is possible for _g_io_module_get_default() to be called recursively
(eg, if a module of one type is loaded that tries to look up gsettings
from its init() method and ends up causing the gsettings module to be
loaded). So use a recursive mutex.
Diffstat (limited to 'gio/giomodule.c')
-rw-r--r-- | gio/giomodule.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gio/giomodule.c b/gio/giomodule.c index 61638c08f..c7a002042 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -630,7 +630,7 @@ g_io_modules_load_all_in_directory (const char *dirname) return g_io_modules_load_all_in_directory_with_scope (dirname, NULL); } -G_LOCK_DEFINE_STATIC (default_modules); +GRecMutex default_modules_lock; GHashTable *default_modules; static gpointer @@ -692,7 +692,7 @@ _g_io_module_get_default (const gchar *extension_point, GIOExtension *extension, *preferred; gpointer impl; - G_LOCK (default_modules); + g_rec_mutex_lock (&default_modules_lock); if (default_modules) { gpointer key; @@ -700,7 +700,7 @@ _g_io_module_get_default (const gchar *extension_point, if (g_hash_table_lookup_extended (default_modules, extension_point, &key, &impl)) { - G_UNLOCK (default_modules); + g_rec_mutex_unlock (&default_modules_lock); return impl; } } @@ -715,7 +715,7 @@ _g_io_module_get_default (const gchar *extension_point, if (!ep) { g_warn_if_reached (); - G_UNLOCK (default_modules); + g_rec_mutex_unlock (&default_modules_lock); return NULL; } @@ -752,7 +752,7 @@ _g_io_module_get_default (const gchar *extension_point, g_hash_table_insert (default_modules, g_strdup (extension_point), impl ? g_object_ref (impl) : NULL); - G_UNLOCK (default_modules); + g_rec_mutex_unlock (&default_modules_lock); return impl; } |