Crashes with SBParticleSystem
-
This piece of code that I used crashes SAMSON 0.7.0:
void MyClass::myFunction(const SBNodeIndexer& nodeIndexer) { // Create particle system SBParticleSystem particleSystem(nodeIndexer); }
While the following one does not crash
void MyClass::myFunction(const SBNodeIndexer& nodeIndexer) { // Create particle system SBPointer<SBParticleSystem> particleSystem(new SBParticleSystem(nodeIndexer)); }
-
Hi Khoa, yes, it's always better to create nodes on the heap instead of the stack (i.e. with new). Therefore, you should use a SAMSON pointer (SBPointer) to hold it and destroy the node automatically when the variable gets out of scope.