Hello Michael,

On 06/25/2014 11:25 AM, Michael Raab wrote:
I got it. The problem was that I used a set() function for a field in
the RenderChannel constructor (That worked without problems in 1.8
:-)).

glad to hear you found the problem!
For this kind of initialization there is onCreateAspect() (must call the base class' onCreateAspect), which is called after the container is registered with the FieldContainerFactory (and thus has a valid id).

That caused the _pContainerChanges entry to be created. But the
initialization of it was corrupt as the RenderChannel instance was not
yet aware of its containerID. As the cleanup of pContainerChanges is
triggered by containerID it was never successful.
So this is actually no bug in OpenSG but maybe it would be good to have
a warning message or some kind of special handling in
registerChangedContainer() if the containerID is set to 0.

I'm adding the attached, which hopefully catches these cases in debug builds.

        Cheers,
                Carsten
diff --git a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
index 357795b..4a2017c 100644
--- a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
+++ b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
@@ -277,6 +277,18 @@ void FieldContainer::registerChangedContainer(void)
 
     osgSpinLock(&_uiContainerId, SpinLockBit);
 
+#ifdef OSG_DEBUG
+    // Check if the container is registered with the FC factory.
+    // This catches e.g. cases where fields are modified in the c'tor instead
+    // of the onCreate/onCreateAspect functions.
+    if(_uiContainerId == 0)
+    {
+        SWARNING << "FieldContainer::registerChangedContainer called without "
+                 << "valid _uiContainerId!"
+                 << std::endl;
+    }
+#endif
+
     ChangeList* pCL = Thread::getCurrentChangeList();
 
     if(_pContainerChanges == NULL)
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to