q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1e55e2642220a0ef3e1fcb0fa6a0f4dc2e7f11c2

commit 1e55e2642220a0ef3e1fcb0fa6a0f4dc2e7f11c2
Author: Daniel Kolesa <[email protected]>
Date:   Fri Oct 10 15:44:49 2014 +0100

    elua: properly hook up gc so that eo objects are unref'd in C when collected
---
 src/bindings/luajit/eo.lua | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index a58069a..ae26c61 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -184,6 +184,10 @@ M.class_mixin = function(name, mixin)
     classes[name]:mixin(classes[mixin])
 end
 
+local obj_gccb = function(obj)
+    eo.eo_unref(obj)
+end
+
 M.__ctor_common = function(klass, parent, ctor, loff, ...)
     local info   = getinfo(2 + (loff or 0), "nlSf")
     local source = info.source
@@ -197,6 +201,7 @@ M.__ctor_common = function(klass, parent, ctor, loff, ...)
         ret = eo.eo_finalize()
         eo._eo_do_end(nil)
     end
+    ffi.gc(ret, obj_gccb)
     return ret
 end
 

-- 


Reply via email to