No, you shouldn't use delete.
Just call remove, which automatically removes it from it's parent's list and calls drop. If another grab exists, the scenenode won't be deleted, so no access to an invalid object access will happen, but if no other drop exists, it will be deleted.
But after a creation with new, the scenenode has an reference count of 1 and it's parent calls grab, so you have to drop it after the creation.
You don't need to call removeAll, because all children are removed if the deletion of the node.
That's not correct. In Irrlicht you should always call drop() when you use new. While calling remove() will remove nodes from a scenemanager and drop the scenemanager reference - it certainly will not(!) drop references you created yourself (meaning using 'new' or a function starting with create). So in Irrlicht would call node->remove() and then node->drop() when you created it with new. Or if you don't need the reference yourself you can even call drop() directly after adding it to the scenemanger - then you only need to call remove() later.
//class ShapeSceneNode : public irr::scene::ISceneNode; just to show where this is inherited from
ShapeSceneNode* shape = new ShapeSceneNode(p->GetDevice()->getSceneManager()->getRootSceneNode(),
p->GetDevice()->getSceneManager(), -1,
p->GetDriver()->getTexture(textureFilename),
sides, false);
if(shape)
{
shape->removeAll();
shape->remove();
shape->drop();
shape = nullptr;
}
@kklouzal: No, you shouldn't do the delete - and especially not the delete[] (you only ever do that when you are creating arrays of a type - not when you create a single CDynamicMeshBuffer object - it does not matter if that object internally uses arrays or something. You never should need to know about what's inside a class. You only care about the objects you create - which is in this case just one instance of CDynamicMeshBuffer)
@Mars_999: You don't need the removeAll - children are removed automatically anyway on remove (removeAll is when you want to remove the children but not the node itself). Your second solution with the additinal delete should usually crash - if it doesn't it might mean you have one more reference somewhere to this object so you might want to check this (you can call getReferenceCount () for debugging or use directly watches in the debugger to check the reference-counter in different places).