Use a separate lock for extension point registration to avoid deadlock.

* giomodule.c: Use a separate lock for extension point registration
        to avoid deadlock. Discovered by Torsten Schoenfeld


svn path=/trunk/; revision=7935
This commit is contained in:
Matthias Clasen 2009-03-02 03:50:09 +00:00
parent 74882fb655
commit 0712b73358
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2009-03-01 Matthias Clasen <mclasen@redhat.com>
Bug 573658 Deadlock in giomodule.c
* giomodule.c: Use a separate lock for extension point registration
to avoid deadlock. Discovered by Torsten Schoenfeld
2009-03-01 Matthias Clasen <mclasen@redhat.com> 2009-03-01 Matthias Clasen <mclasen@redhat.com>
* gdatainputstream.c: Fix docs * gdatainputstream.c: Fix docs

View File

@ -283,6 +283,7 @@ g_io_modules_load_all_in_directory (const char *dirname)
return modules; return modules;
} }
G_LOCK_DEFINE_STATIC (registered_extensions);
G_LOCK_DEFINE_STATIC (loaded_dirs); G_LOCK_DEFINE_STATIC (loaded_dirs);
extern GType _g_fen_directory_monitor_get_type (void); extern GType _g_fen_directory_monitor_get_type (void);
@ -302,7 +303,7 @@ _g_io_modules_ensure_extension_points_registered (void)
static gboolean registered_extensions = FALSE; static gboolean registered_extensions = FALSE;
GIOExtensionPoint *ep; GIOExtensionPoint *ep;
G_LOCK (loaded_dirs); G_LOCK (registered_extensions);
if (!registered_extensions) if (!registered_extensions)
{ {
@ -329,7 +330,7 @@ _g_io_modules_ensure_extension_points_registered (void)
g_io_extension_point_set_required_type (ep, G_TYPE_VFS); g_io_extension_point_set_required_type (ep, G_TYPE_VFS);
} }
G_UNLOCK (loaded_dirs); G_UNLOCK (registered_extensions);
} }
void void