luaobject: change function push method in signal emit
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f111d0cab1
commit
c180904d77
|
@ -227,14 +227,28 @@ luaA_object_emit_signal(lua_State *L, int oud,
|
||||||
signal_t *sigfound = signal_array_getbyid(&obj->signals,
|
signal_t *sigfound = signal_array_getbyid(&obj->signals,
|
||||||
a_strhash((const unsigned char *) name));
|
a_strhash((const unsigned char *) name));
|
||||||
if(sigfound)
|
if(sigfound)
|
||||||
foreach(ref, sigfound->sigfuncs)
|
{
|
||||||
|
int nbfunc = sigfound->sigfuncs.len;
|
||||||
|
luaL_checkstack(L, lua_gettop(L) + nbfunc + nargs + 2, "too much signal");
|
||||||
|
/* Push all functions and then execute, because this list can change
|
||||||
|
* while executing funcs. */
|
||||||
|
foreach(func, sigfound->sigfuncs)
|
||||||
|
luaA_object_push_item(L, oud_abs, (void *) *func);
|
||||||
|
|
||||||
|
for(int i = 0; i < nbfunc; i++)
|
||||||
{
|
{
|
||||||
|
/* push object */
|
||||||
lua_pushvalue(L, oud_abs);
|
lua_pushvalue(L, oud_abs);
|
||||||
for(int i = 0; i < nargs; i++)
|
/* push all args */
|
||||||
lua_pushvalue(L, - nargs - 1);
|
for(int j = 0; j < nargs; j++)
|
||||||
luaA_object_push_item(L, oud_abs, (void *) *ref);
|
lua_pushvalue(L, - nargs - nbfunc - 1 + i);
|
||||||
|
/* push first function */
|
||||||
|
lua_pushvalue(L, - nargs - nbfunc - 1 + i);
|
||||||
|
/* remove this first function */
|
||||||
|
lua_remove(L, - nargs - nbfunc - 2 + i);
|
||||||
luaA_dofunction(L, nargs + 1, 0);
|
luaA_dofunction(L, nargs + 1, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lua_pop(L, nargs);
|
lua_pop(L, nargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue