aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-04-07 20:33:00 +0200
committerkwolekr <kwolekr@minetest.net>2013-04-07 21:49:55 -0400
commite1146396bc043782b288226c027bc28857ccf4d2 (patch)
treea295ae7123bc33de9f04bf3234314dc3f79b60c7
parent7c0e707cf1d0031788567bfec66f6c13ec901cdc (diff)
downloadminetest-e1146396bc043782b288226c027bc28857ccf4d2.tar.gz
minetest-e1146396bc043782b288226c027bc28857ccf4d2.tar.bz2
minetest-e1146396bc043782b288226c027bc28857ccf4d2.zip
fix mesh leak in camera class
-rw-r--r--src/camera.cpp8
-rw-r--r--src/camera.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index 138b022c0..735a8d1e9 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -69,7 +69,8 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
m_view_bobbing_speed(0),
m_digging_anim(0),
- m_digging_button(-1)
+ m_digging_button(-1),
+ m_dummymesh(createCubeMesh(v3f(1,1,1)))
{
//dstream<<__FUNCTION_NAME<<std::endl;
@@ -84,13 +85,14 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
// all other 3D scene nodes and before the GUI.
m_wieldmgr = smgr->createNewSceneManager();
m_wieldmgr->addCameraSceneNode();
- m_wieldnode = m_wieldmgr->addMeshSceneNode(createCubeMesh(v3f(1,1,1)), NULL); // need a dummy mesh
+ m_wieldnode = m_wieldmgr->addMeshSceneNode(m_dummymesh, NULL); // need a dummy mesh
}
Camera::~Camera()
{
- m_wieldnode->setMesh(NULL);
m_wieldmgr->drop();
+
+ delete m_dummymesh;
}
bool Camera::successfullyCreated(std::wstring& error_message)
diff --git a/src/camera.h b/src/camera.h
index fc43d1176..989dcb718 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -173,6 +173,9 @@ private:
// If 0, left-click digging animation
// If 1, right-click digging animation
s32 m_digging_button;
+
+ //dummymesh for camera
+ irr::scene::IAnimatedMesh* m_dummymesh;
};
#endif