Add some missing luaA_checkudata() calls
luaA_object_ref_item doesn't check the type of object it returns which resulted in stuff like this: wibox.shape_clip = wibox wibox.shape_bounding = wibox imagebox.image = imagebox textbox.bg_image = textbox All of the above calls would result in a crash (unverified) and all of them where fixed. This should fix all places which use luaA_object_ref_item(). The others already did a proper type check. Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
769d2899ac
commit
fa89775626
2
wibox.c
2
wibox.c
|
@ -1463,6 +1463,7 @@ luaA_wibox_set_border_width(lua_State *L, wibox_t *wibox)
|
|||
static int
|
||||
luaA_wibox_set_shape_bounding(lua_State *L, wibox_t *wibox)
|
||||
{
|
||||
luaA_checkudata(L, -1, &image_class);
|
||||
luaA_object_unref_item(L, -3, wibox->shape.bounding);
|
||||
wibox->shape.bounding = luaA_object_ref_item(L, -3, -1);
|
||||
wibox->need_shape_update = true;
|
||||
|
@ -1479,6 +1480,7 @@ luaA_wibox_get_shape_bounding(lua_State *L, wibox_t *wibox)
|
|||
static int
|
||||
luaA_wibox_set_shape_clip(lua_State *L, wibox_t *wibox)
|
||||
{
|
||||
luaA_checkudata(L, -1, &image_class);
|
||||
luaA_object_unref_item(L, -3, wibox->shape.clip);
|
||||
wibox->shape.clip = luaA_object_ref_item(L, -3, -1);
|
||||
wibox->need_shape_update = true;
|
||||
|
|
|
@ -133,6 +133,7 @@ luaA_imagebox_newindex(lua_State *L, awesome_token_t token)
|
|||
size_t len;
|
||||
|
||||
case A_TK_IMAGE:
|
||||
luaA_checkudata(L, 1, &image_class);
|
||||
luaA_object_unref_item(L, 1, d->image);
|
||||
d->image = luaA_object_ref_item(L, 1, 3);
|
||||
break;
|
||||
|
|
|
@ -346,6 +346,7 @@ luaA_textbox_newindex(lua_State *L, awesome_token_t token)
|
|||
d->bg_resize = luaA_checkboolean(L, 3);
|
||||
break;
|
||||
case A_TK_BG_IMAGE:
|
||||
luaA_checkudata(L, 1, &image_class);
|
||||
luaA_object_unref_item(L, 1, d->bg_image);
|
||||
d->bg_image = luaA_object_ref_item(L, 1, 3);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue