From 80fad18e3d21929f09fe435835d65dcec753568a Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Mon, 7 Jun 2021 18:01:49 +0300 Subject: [PATCH] lua: remove hack around WpObjectInterest since we can _ref() it now --- modules/module-lua-scripting/api.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/module-lua-scripting/api.c b/modules/module-lua-scripting/api.c index 0229c52b..8b4e5e6a 100644 --- a/modules/module-lua-scripting/api.c +++ b/modules/module-lua-scripting/api.c @@ -658,15 +658,9 @@ object_manager_new (lua_State *L) lua_pushnil (L); while (lua_next (L, 1)) { - if (!wplua_isboxed (L, -1, WP_TYPE_OBJECT_INTEREST)) - luaL_error (L, "ObjectManager: expected Interest"); - - /* steal the interest out of the GValue to avoid doing mem copy */ - GValue *v = lua_touserdata (L, -1); - wp_object_manager_add_interest_full (om, g_value_get_boxed (v)); - memset (v, 0, sizeof (GValue)); - g_value_init (v, WP_TYPE_OBJECT_INTEREST); - + WpObjectInterest *interest = + wplua_checkboxed (L, -1, WP_TYPE_OBJECT_INTEREST); + wp_object_manager_add_interest_full (om, wp_object_interest_ref (interest)); lua_pop (L, 1); }