From 88371e4f989152e38d7fc378f7da45114d34b436 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 12 May 2009 23:49:42 +0000 Subject: [PATCH] Fix interface registration/deregistration mechanics --- .../User/LocalUserServiceConnector.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneBase.cs | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs index 637931e2bd..37286bda0d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs @@ -107,6 +107,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.User { if (!m_Enabled) return; + + scene.RegisterModuleInterface(m_UserService); } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 4efcb63346..f49366ac89 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -368,19 +368,24 @@ namespace OpenSim.Region.Framework.Scenes /// public void RegisterModuleInterface(M mod) { - if (!ModuleInterfaces.ContainsKey(typeof(M))) + List l = null; + if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) { - List l = new List(); - l.Add(mod); + l = new List(); ModuleInterfaces.Add(typeof(M), l); + } - if (mod is IEntityCreator) + if (l.Count > 0) + return; + + l.Add(mod); + + if (mod is IEntityCreator) + { + IEntityCreator entityCreator = (IEntityCreator)mod; + foreach (PCode pcode in entityCreator.CreationCapabilities) { - IEntityCreator entityCreator = (IEntityCreator)mod; - foreach (PCode pcode in entityCreator.CreationCapabilities) - { - m_entityCreators[pcode] = entityCreator; - } + m_entityCreators[pcode] = entityCreator; } } }