lua-users home
lua-l archive

problem: using bg(fg)color_cb on matrix will cause the lua stack increase on every cb execute

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


in iuplua_matrix_aux.c:
matrix_bgcolor_cb and matrix_fgcolor_cb, should lua_pop(L,4) instead lua_pop(L,1)

static int matrix_bg[fg]color_cb(Ihandle *self, int p0, int p1, unsigned int *p2, unsigned int *p3, unsigned int *p4)
{
int ret;
lua_State *L = iuplua_call_start(self, "bgcolor_cb");
lua_pushnumber(L, p0);
lua_pushnumber(L, p1);
ret = iuplua_call_raw(L, 2+2, LUA_MULTRET); /* 2 args + 2 args(errormsg, handle), variable number of returns */
if (ret || lua_isnil(L, -1))
return IUP_DEFAULT;
ret = lua_tointeger(L,-1);

if (ret == IUP_IGNORE)
{
lua_pop(L, 1);
return IUP_IGNORE;
}

*p2 = (unsigned int)lua_tointeger(L, -4);
*p3 = (unsigned int)lua_tointeger(L, -3);
*p4 = (unsigned int)lua_tointeger(L, -2);
lua_pop(L, 1); -------------- this should be lua_pop(L,4);
return IUP_DEFAULT;
}




AltStyle によって変換されたページ (->オリジナル) /