Directory: fix concurreny issue

If more than one thread would call _get_plugin_directory at the
same time and there was no plugin created then this may lead to
a race and each thread may have a different list of plugin data.

Change-Id: Id5d23f06e5f59fc07b660ef6c23cacf8cde1b999
This commit is contained in:
Gary Kotton
2016-12-18 21:46:05 +02:00
parent 36ebf95938
commit f48adb004b

View File

@@ -66,7 +66,8 @@ _PLUGIN_DIRECTORY = None
@_synchronized("plugin-directory")
def _create_plugin_directory():
global _PLUGIN_DIRECTORY
_PLUGIN_DIRECTORY = _PluginDirectory()
if _PLUGIN_DIRECTORY is None:
_PLUGIN_DIRECTORY = _PluginDirectory()
return _PLUGIN_DIRECTORY