Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Mono.Addins/Mono.Addins/InstanceExtensionNode.cs')
-rw-r--r--Mono.Addins/Mono.Addins/InstanceExtensionNode.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs b/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs
index 3d6640d..37e2791 100644
--- a/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs
+++ b/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs
@@ -69,8 +69,13 @@ namespace Mono.Addins
/// </remarks>
public object GetInstance ()
{
- if (cachedInstance == null)
- cachedInstance = CreateInstance ();
+ if (cachedInstance == null) {
+ lock (localLock) {
+ // Use locking here to avoid creating more than one instance per ExtensionNode
+ if (cachedInstance == null)
+ cachedInstance = CreateInstance ();
+ }
+ }
return cachedInstance;
}