diff options
author | Diva Canto | 2009-10-06 15:39:53 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-06 15:39:53 -0700 |
commit | e992ca025571a891333a57012c2cd4419b6581e5 (patch) | |
tree | a6fd7e9f2e46999c72780bf60d2890e8a9c74fe4 /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | * Change some more default ports to the robust default of 8003 (diff) | |
download | opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.zip opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.tar.gz opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.tar.bz2 opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.tar.xz |
Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 54ac792..20b3b5c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -297,34 +297,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
297 | 297 | ||
298 | sceneObject.AttachToScene(m_parentScene); | 298 | sceneObject.AttachToScene(m_parentScene); |
299 | 299 | ||
300 | List<SceneObjectPart> parts = null; | ||
301 | bool found = false; | ||
300 | lock (sceneObject) | 302 | lock (sceneObject) |
301 | { | 303 | { |
302 | if (!Entities.ContainsKey(sceneObject.UUID)) | 304 | if (!Entities.ContainsKey(sceneObject.UUID)) |
303 | { | 305 | { |
306 | found = true; | ||
304 | Entities.Add(sceneObject); | 307 | Entities.Add(sceneObject); |
305 | m_numPrim += sceneObject.Children.Count; | 308 | m_numPrim += sceneObject.Children.Count; |
306 | 309 | ||
307 | if (attachToBackup) | 310 | if (attachToBackup) |
308 | sceneObject.AttachToBackup(); | 311 | sceneObject.AttachToBackup(); |
309 | 312 | ||
310 | if (OnObjectCreate != null) | 313 | parts = new List<SceneObjectPart>(sceneObject.Children.Values); |
311 | OnObjectCreate(sceneObject); | 314 | |
312 | 315 | } | |
313 | lock (m_dictionary_lock) | 316 | } |
317 | |||
318 | if (found) | ||
319 | { | ||
320 | lock (m_dictionary_lock) | ||
321 | { | ||
322 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | ||
323 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
324 | foreach (SceneObjectPart part in parts) | ||
314 | { | 325 | { |
315 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 326 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
316 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 327 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; |
317 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
318 | { | ||
319 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | ||
320 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | ||
321 | } | ||
322 | } | 328 | } |
323 | |||
324 | return true; | ||
325 | } | 329 | } |
330 | |||
331 | if (OnObjectCreate != null) | ||
332 | OnObjectCreate(sceneObject); | ||
333 | |||
334 | return true; | ||
326 | } | 335 | } |
327 | 336 | ||
337 | |||
328 | return false; | 338 | return false; |
329 | } | 339 | } |
330 | 340 | ||