summaryrefslogtreecommitdiff
path: root/src/BLua.cc
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-09-06 21:00:39 -0700
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2012-09-06 21:00:39 -0700
commitc79fc0cfcabb252b18210c9880f6eb4427c21f38 (patch)
tree5d2a28184d806ef2768d3cc14908a56558982917 /src/BLua.cc
parent2ff5eca44aefd7e6233b5f8fa628af7fc81ec3d1 (diff)
Fixing LuaObject's destructor.
Diffstat (limited to 'src/BLua.cc')
-rw-r--r--src/BLua.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/BLua.cc b/src/BLua.cc
index e9df8b7..2114124 100644
--- a/src/BLua.cc
+++ b/src/BLua.cc
@@ -232,7 +232,7 @@ int Balau::LuaStatics::collector(lua_State * __L) {
Lua L(__L);
ObjData * u = (ObjData *) L.touserdata();
if (u->isObj) {
- LuaObjectFactory * obj = (LuaObjectFactory *) u->ptr;
+ LuaObject * obj = (LuaObject *) u->ptr;
delete obj;
} else {
free(u->ptr);
@@ -245,14 +245,7 @@ int Balau::LuaStatics::destructor(lua_State * __L) {
Lua L(__L);
L.push("__obj");
L.gettable(-2, true);
- ObjData * u = (ObjData *) L.touserdata();
- if (u->isObj) {
- LuaObjectFactory * obj = (LuaObjectFactory *) u->ptr;
- delete obj;
- } else {
- free(u->ptr);
- }
- u->ptr = NULL;
+ collector(__L);
L.pop();
return 0;
}