diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-22 15:46:46 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-22 15:46:46 +1100 |
| commit | 9eb5ae6e946651bdbe532b66700bb1ed6944584f (patch) | |
| tree | 91a69573e4c481ff97c598213b08aa41e61aab76 /src/lua/property.cpp | |
| parent | 06aca259cbb84c41a002e5a93735b289cc2aa93a (diff) | |
| download | tangara-fw-9eb5ae6e946651bdbe532b66700bb1ed6944584f.tar.gz | |
Use protected mode for lua callbacks wherever possible
Diffstat (limited to 'src/lua/property.cpp')
| -rw-r--r-- | src/lua/property.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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 <string> #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 } } |
