Closed florent-lamiraux closed 2 years ago
I would say yes. One reference hold by the cache, one hold by collada_ptr_
.
You are right. The problem is that the object does not seem to be removed from the cache here: https://github.com/florent-lamiraux/gepetto-viewer/blob/ec82cb0c80082c4c4c13195705aa2ccae3439216/src/leaf-node-collada.cpp#L459 The number of reference counts is the same before and after this line. I am investigating.
I think we have to store the option used to load the mesh and pass it to removeFromObjectCache
.
Looking at OpenSceneGraph code you are probably right. I will try.
To display an octree, I create an obj file that I then load through CORBA by calling method
WindowsManager::addMesh
. This function callsLeafNodeCollada::create
that callsLeafNodeCollada::init
.After this line, https://github.com/Gepetto/gepetto-viewer/blob/7e420b7d07013f97198235000e943592f69d9c1a/src/leaf-node-collada.cpp#L110 the number of
referenceCount
ofcollada_ptr_
is 2 although I expect it to be 1. As a consequence, in the desctructor the test https://github.com/Gepetto/gepetto-viewer/blob/7e420b7d07013f97198235000e943592f69d9c1a/src/leaf-node-collada.cpp#L439 is always false and the object is never removed from the cache. As a consequence, reloading the object after deleting the node displayes the previous object eventhough the files has been modified.I tried to add a method to explicitely remove the object from the cache when deleting the node, but it does not solve the problem. I also tried to decrement manually the counter by adding
after line 110 above, but I got a segmentation fault.
Does anyone know whether it is normal that the reference count is equal to 2 just after creating the object ?