diff options
author | sapier <Sapier at GMX dot net> | 2014-06-29 11:57:01 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-06-29 11:57:01 +0200 |
commit | 1367895ae226b4bbdc152274329c789cb5738022 (patch) | |
tree | 1808d49ae28ba84e992a79c1df19e63dc230afe3 /src/content_cao.cpp | |
parent | 3c5df42a17886395cee6141663f84dba15bd11d9 (diff) | |
download | minetest-1367895ae226b4bbdc152274329c789cb5738022.tar.gz minetest-1367895ae226b4bbdc152274329c789cb5738022.tar.bz2 minetest-1367895ae226b4bbdc152274329c789cb5738022.zip |
Make sure none of the irrlicht member objects of GenericCAO are deleted prior deletion of GenericCAO
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index aa999b3af..a05936d2c 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -751,6 +751,7 @@ void GenericCAO::removeFromScene(bool permanent) if(m_meshnode) { m_meshnode->remove(); + m_meshnode->drop(); m_meshnode = NULL; } if(m_animated_meshnode) @@ -762,8 +763,15 @@ void GenericCAO::removeFromScene(bool permanent) if(m_spritenode) { m_spritenode->remove(); + m_spritenode->drop(); m_spritenode = NULL; } + if (m_textnode) + { + m_textnode->remove(); + m_textnode->drop(); + m_textnode = NULL; + } } void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, @@ -787,6 +795,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, infostream<<"GenericCAO::addToScene(): single_sprite"<<std::endl; m_spritenode = smgr->addBillboardSceneNode( NULL, v2f(1, 1), v3f(0,0,0), -1); + m_spritenode->grab(); m_spritenode->setMaterialTexture(0, tsrc->getTexture("unknown_node.png")); m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false); @@ -852,6 +861,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, buf->drop(); } m_meshnode = smgr->addMeshSceneNode(mesh, NULL); + m_meshnode->grab(); mesh->drop(); // Set it to use the materials of the meshbuffers directly. // This is needed for changing the texture in the future @@ -861,6 +871,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, infostream<<"GenericCAO::addToScene(): cube"<<std::endl; scene::IMesh *mesh = createCubeMesh(v3f(BS,BS,BS)); m_meshnode = smgr->addMeshSceneNode(mesh, NULL); + m_meshnode->grab(); mesh->drop(); m_meshnode->setScale(v3f(m_prop.visual_size.X, @@ -912,6 +923,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, scene::IMesh *mesh = manip->createMeshUniquePrimitives(item_mesh); m_meshnode = smgr->addMeshSceneNode(mesh, NULL); + m_meshnode->grab(); mesh->drop(); m_meshnode->setScale(v3f(m_prop.visual_size.X/2, @@ -939,6 +951,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, std::wstring wname = narrow_to_wide(m_name); m_textnode = smgr->addTextSceneNode(gui->getBuiltInFont(), wname.c_str(), video::SColor(255,255,255,255), node); + m_textnode->grab(); m_textnode->setPosition(v3f(0, BS*1.1, 0)); } |