m-lua-scripting: Fix bug in WpEvent referencing

While calling async execute closure, take a reference to the WpEvent
object before pushing it to the Lua stack. Otherwise Lua garbage
collector frees it, which leads to invalid memory access.
This commit is contained in:
Ashok Sidipotu
2022-06-16 14:51:31 +05:30
committed by Julian Bouzas
parent fbac3a38a9
commit 4d1a86ced1

View File

@@ -1893,7 +1893,7 @@ async_event_hook_execute_step (lua_State *L)
return 0;
}
wplua_pushboxed (L, WP_TYPE_EVENT, event);
wplua_pushboxed (L, WP_TYPE_EVENT, wp_event_ref (event));
wplua_pushobject (L, g_object_ref (transition));
lua_call (L, 2, 0);
return 0;