Hi Robert,

Working with Jorge we have spot than lastest changes in Scene.cpp has
broken execution for Android devices. The change is:

Index: src/osgViewer/Scene.cpp
===================================================================
--- src/osgViewer/Scene.cpp     (revision 13030)
+++ src/osgViewer/Scene.cpp     (revision 13031)
@@ -18,15 +18,15 @@

 typedef std::vector< osg::observer_ptr<Scene> >  SceneCache;

+static SceneCache s_sceneCache;
 static SceneCache& getSceneCache()
 {
-    static SceneCache s_sceneCache;
     return s_sceneCache;
 }

+static OpenThreads::Mutex s_sceneCacheMutex;
 static OpenThreads::Mutex& getSceneCacheMutex()
 {
-    static OpenThreads::Mutex s_sceneCacheMutex;
     return s_sceneCacheMutex;
 }

Looks like static initialization is not correctly done (Android
building currently builds in static), and crashes trying to do a
ScopedLock.

Comes to my mind two possible solutions:
1. Keep SceneCache inside osgDB::Registry to solve exit() problems you
mentioned in the commit and global static initialization of the mutex
and the cache for android.
2. Create a Singleton class (SceneCacheSingleton) that creates
correctly both variables to solve both problems too.

both methods allows us to maintain compatibility using 'getSceneCache'
and 'getSceneCacheMutex' and calling the correct Singleton.

I prefer 1st solution but maybe you have another idea or solution to
this issue. Thoughts?

Cheers,
Rafa.

-- 
Rafael Gaitán Linares
CTO at Mirage Technologies S.L - http://www.mirage-tech.com
gvSIG3D Developer - http://gvsig3d.blogspot.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to