forked from enlightenment/efl
elua: connect the del event on first callback connect
This commit is contained in:
parent
f020171bf2
commit
00e2f5d882
|
@ -159,17 +159,21 @@ local connect = function(self, ename, func, priority)
|
||||||
end
|
end
|
||||||
local cl = eo_classes["Eo_Base"]
|
local cl = eo_classes["Eo_Base"]
|
||||||
-- add the callback to the respective array
|
-- add the callback to the respective array
|
||||||
|
local cdel = false
|
||||||
local addr = eo_obj_addr_get(self)
|
local addr = eo_obj_addr_get(self)
|
||||||
local cbs = eo_callbacks[addr]
|
local cbs = eo_callbacks[addr]
|
||||||
if not cbs then
|
if not cbs then
|
||||||
cbs = {}
|
cbs = {}
|
||||||
eo_callbacks[addr] = cbs
|
eo_callbacks[addr] = cbs
|
||||||
|
cdel = true
|
||||||
end
|
end
|
||||||
local cidx = #cbs + 1
|
local cidx = #cbs + 1
|
||||||
cbs[cidx] = func
|
cbs[cidx] = func
|
||||||
M.__do_start(self, cl)
|
M.__do_start(self, cl)
|
||||||
eo.eo_event_callback_priority_add(ev, priority or 0,
|
eo.eo_event_callback_priority_add(ev, priority or 0,
|
||||||
eo_event_cb, ffi.cast("void *", cidx))
|
eo_event_cb, ffi.cast("void *", cidx))
|
||||||
|
eo.eo_event_callback_priority_add(eo._EO_BASE_EVENT_DEL, 0, eo_event_del,
|
||||||
|
nil)
|
||||||
M.__do_end()
|
M.__do_end()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -318,8 +322,6 @@ M.__ctor_common = function(klass, parent, ctor, loff, ...)
|
||||||
ret = eo.eo_finalize()
|
ret = eo.eo_finalize()
|
||||||
eo._eo_do_end(nil)
|
eo._eo_do_end(nil)
|
||||||
end
|
end
|
||||||
eo.eo_event_callback_priority_add(eo._EO_BASE_EVENT_DEL, 0, eo_event_del,
|
|
||||||
nil)
|
|
||||||
ffi.gc(ret, obj_gccb)
|
ffi.gc(ret, obj_gccb)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue