From 9eb5ae6e946651bdbe532b66700bb1ed6944584f Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 22 Nov 2023 15:46:46 +1100 Subject: Use protected mode for lua callbacks wherever possible --- src/lua/property.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lua/property.cpp') diff --git a/src/lua/property.cpp b/src/lua/property.cpp index f0383dd8..c63d243f 100644 --- a/src/lua/property.cpp +++ b/src/lua/property.cpp @@ -10,6 +10,7 @@ #include #include "lua.hpp" +#include "lua_thread.hpp" #include "lvgl.h" #include "service_locator.hpp" @@ -49,9 +50,8 @@ static auto property_bind(lua_State* state) -> int { // ...and another copy, since we return the original closure. lua_pushvalue(state, 2); - // FIXME: This should ideally be lua_pcall, for safety. p->PushValue(*state); - lua_call(state, 1, 0); // Invoke the initial binding. + CallProtected(state, 1, 0); // Invoke the initial binding. lua_pushstring(state, kBindingsTable); lua_gettable(state, LUA_REGISTRYINDEX); // REGISTRY[kBindingsTable] @@ -229,7 +229,7 @@ auto Property::Update(const LuaValue& v) -> void { } PushValue(*b.first); // push the argument - lua_call(b.first, 1, 0); // invoke the closure + CallProtected(b.first, 1, 0); // invoke the closure } } -- cgit v1.2.3