Hi all,
I’m stumbling upon the following error:
Assertion failed: _ref_count == 0 || _ref_count == local_ref_count at line 108 of c:\buildslave\sdk-windows-amd64\build\built1.10\include\referenceCount.I
Assertion failed: _node != nullptr at line 46 of c:\buildslave\sdk-windows-amd64\build\built1.10\include\nodePathComponent.I
Traceback (most recent call last):
File "C:\Panda3D-1.10.10-x64\direct\showbase\ShowBase.py", line 2117, in __collisionLoop
self.cTrav.traverse(self.render)
AssertionError: _ref_count == 0 || _ref_count == local_ref_count at line 108 of c:\buildslave\sdk-windows-amd64\build\built1.10\include\referenceCount.I
:task(error): Exception occurred in PythonTask collisionLoop
Traceback (most recent call last):
File "testing_file.py", line 570, in <module>
w.run()
File "C:\Panda3D-1.10.10-x64\direct\showbase\ShowBase.py", line 3325, in run
self.taskMgr.run()
File "C:\Panda3D-1.10.10-x64\direct\task\Task.py", line 546, in run
self.step()
File "C:\Panda3D-1.10.10-x64\direct\task\Task.py", line 500, in step
self.mgr.poll()
File "C:\Panda3D-1.10.10-x64\direct\showbase\ShowBase.py", line 2117, in __collisionLoop
self.cTrav.traverse(self.render)
AssertionError: _ref_count == 0 || _ref_count == local_ref_count at line 108 of c:\buildslave\sdk-windows-amd64\build\built1.10\include\referenceCount.I
I’m running a test whereby the collisionNodes that will be the into are made in the c++ side, but the from collisionNode is made in the python side and consists of a single collisionBox.
This is how in brief, the into collisionNodes are made:
std::vector<PT(CollisionNode)> collision_nodes;
...
int counter_cnn=0;
PT(CollisionNode) coll_node_gen;
...
for(int x=0;x<max_limit;x++)
{
if(counter_cnn==0)
{
coll_node_gen= new CollisionNode("col_poly_set");
collision_nodes.push_back(coll_node_gen);
}
PT(CollisionPolygon) c_pol = new CollisionPolygon(pnt1,pnt2,pnt3,pnt4);
coll_node_gen->add_solid(c_pol);
counter_cnn++;
if(counter_cnn==7)
counter_cnn=0;
}
...
int f_nodes_size=collision_nodes.size();
BitMask32 floor_mask;
floor_mask.set_bit(1);
for(int i=0;i<f_nodes_size;i++)
{
NodePath np_cn=np_floor.attach_new_node(collision_nodes[i]);
np_cn.set_name("0.0.cnode.0");
np_cn.node()->set_into_collide_mask(floor_mask);
}
...
That is the c++ side, which is done in a c++ asyncTask, for speed reasons. The python side is direct:
...
box=CollisionBox(minimum,maximum)
cn=render.attachNewNode(CollisionNode('cnode'))
cn.node().addSolid(box)
cn.show()
cn.node().setFromCollideMask(BitMask32.allOn())
cn.node().setIntoCollideMask(BitMask32.allOff())
self.boxQueue=CollisionHandlerQueue()
self.traverser = CollisionTraverser('traverser')
base.cTrav = self.traverser
base.cTrav.addCollider(cn, self.boxQueue)
...
However, the application crashes with the aforementioned error. It doesn’t crash if nothing is added to the traverser. Simply adding the collider to the traverser yields the reference count issue. Am I overlooking something or doing something incorrectly? What could be the issue?
Any help or pointers will be much appreciated. If there is anymore information needed to understand what could be causing the crash, kindly ask me.
Thank you in advance.