fixed bug in Engine::Object destructor

git-svn-id: svn://anubis/anaglym/trunk@133 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-28 03:02:10 +00:00
parent 2616100ded
commit e0d20f1a2b
2 changed files with 20 additions and 5 deletions

View File

@ -665,12 +665,15 @@ Engine::Object::Object(const Engine::Object & orig)
Engine::Object::~Object()
{
delete m_ode_object;
(*m_display_list_refcnt)--;
if (*m_display_list_refcnt < 1)
if (m_display_list_refcnt != NULL)
{
/* we hold the last reference to the OpenGL display list */
delete m_display_list_refcnt;
glDeleteLists(m_display_list, 1);
(*m_display_list_refcnt)--;
if (*m_display_list_refcnt < 1)
{
/* we hold the last reference to the OpenGL display list */
delete m_display_list_refcnt;
glDeleteLists(m_display_list, 1);
}
}
}

12
ag.cc
View File

@ -40,6 +40,18 @@ namespace ag
{ "isKeyDown", isKeyDown },
{ "registerEventHandler", registerEventHandler },
{ "clearEventHandler", clearEventHandler },
{ "createBox", createBox},
{ "createStaticBox", createStaticBox},
{ "createSphere", createSphere},
{ "createStaticSphere", createStaticSphere},
{ "createPlane", createPlane},
{ "createStaticPlane", createStaticPlane},
{ "createCylinder", createCylinder},
{ "createStaticCylinder", createStaticCylinder},
{ "createCCylinder", createCCylinder},
{ "createStaticCCylinder", createStaticCCylinder},
{ NULL, NULL }
};
luaL_register(L, "ag", functions);