summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-03-04 10:31:48 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2015-03-04 10:32:16 +0000
commit00e2f5d882349300aa95a54dd50132aa4fac881a (patch)
tree5123ce399eee3820b81477ca1ed7053a046c5263 /src/bindings
parentf020171bf2fca0c2f30199904798b79dba929c65 (diff)
elua: connect the del event on first callback connect
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/luajit/eo.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index 4e047bc89b..22f9094c06 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -159,17 +159,21 @@ local connect = function(self, ename, func, priority)
159 end 159 end
160 local cl = eo_classes["Eo_Base"] 160 local cl = eo_classes["Eo_Base"]
161 -- add the callback to the respective array 161 -- add the callback to the respective array
162 local cdel = false
162 local addr = eo_obj_addr_get(self) 163 local addr = eo_obj_addr_get(self)
163 local cbs = eo_callbacks[addr] 164 local cbs = eo_callbacks[addr]
164 if not cbs then 165 if not cbs then
165 cbs = {} 166 cbs = {}
166 eo_callbacks[addr] = cbs 167 eo_callbacks[addr] = cbs
168 cdel = true
167 end 169 end
168 local cidx = #cbs + 1 170 local cidx = #cbs + 1
169 cbs[cidx] = func 171 cbs[cidx] = func
170 M.__do_start(self, cl) 172 M.__do_start(self, cl)
171 eo.eo_event_callback_priority_add(ev, priority or 0, 173 eo.eo_event_callback_priority_add(ev, priority or 0,
172 eo_event_cb, ffi.cast("void *", cidx)) 174 eo_event_cb, ffi.cast("void *", cidx))
175 eo.eo_event_callback_priority_add(eo._EO_BASE_EVENT_DEL, 0, eo_event_del,
176 nil)
173 M.__do_end() 177 M.__do_end()
174 return true 178 return true
175end 179end
@@ -318,8 +322,6 @@ M.__ctor_common = function(klass, parent, ctor, loff, ...)
318 ret = eo.eo_finalize() 322 ret = eo.eo_finalize()
319 eo._eo_do_end(nil) 323 eo._eo_do_end(nil)
320 end 324 end
321 eo.eo_event_callback_priority_add(eo._EO_BASE_EVENT_DEL, 0, eo_event_del,
322 nil)
323 ffi.gc(ret, obj_gccb) 325 ffi.gc(ret, obj_gccb)
324 return ret 326 return ret
325end 327end