Fixed RemoveChild and RemoveAllChildren lua functions to delete the children instead of leaking memory.

This commit is contained in:
Kyzentun
2015-02-27 18:33:17 -07:00
parent 7c2fd0153c
commit d35933f1e5
2 changed files with 40 additions and 7 deletions
+9 -7
View File
@@ -721,14 +721,16 @@ public:
static int RemoveChild( T* p, lua_State *L )
{
Actor *pChild = p->GetChild( SArg(1) );
if( pChild )
p->RemoveChild( pChild );
else
lua_pushnil( L );
return 1;
Actor *child = p->GetChild(SArg(1));
if(child)
{
p->RemoveChild(child);
SAFE_DELETE(child);
}
COMMON_RETURN_SELF;
}
static int RemoveAllChildren( T* p, lua_State *L ) { p->RemoveAllChildren( ); COMMON_RETURN_SELF; }
static int RemoveAllChildren( T* p, lua_State *L )
{ p->DeleteAllChildren(); COMMON_RETURN_SELF; }
LunaActorFrame()
{