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/lua_database.cpp | |
| parent | 06aca259cbb84c41a002e5a93735b289cc2aa93a (diff) | |
| download | tangara-fw-9eb5ae6e946651bdbe532b66700bb1ed6944584f.tar.gz | |
Use protected mode for lua callbacks wherever possible
Diffstat (limited to 'src/lua/lua_database.cpp')
| -rw-r--r-- | src/lua/lua_database.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lua/lua_database.cpp b/src/lua/lua_database.cpp index 79916115..4a7c82a5 100644 --- a/src/lua/lua_database.cpp +++ b/src/lua/lua_database.cpp @@ -14,6 +14,7 @@ #include "esp_log.h" #include "lauxlib.h" #include "lua.h" +#include "lua_thread.hpp" #include "lvgl.h" #include "database.hpp" @@ -108,7 +109,7 @@ static auto db_iterate(lua_State* state) -> int { } else { lua_pushnil(state); } - lua_call(state, 1, 0); + CallProtected(state, 1, 0); luaL_unref(state, LUA_REGISTRYINDEX, callback_ref); }); }); @@ -139,7 +140,6 @@ static auto push_iterator( lua_pushcclosure(state, db_iterate, 1); } - static auto record_text(lua_State* state) -> int { LuaRecord* data = reinterpret_cast<LuaRecord*>( luaL_checkudata(state, 1, kDbRecordMetatable)); |
