fix(color): widget Lua 'update' function may give unexpected error (#7119)

This commit is contained in:
philmoz
2026-02-22 09:49:58 +10:00
committed by GitHub
parent 044c2a08d8
commit 653a2013ea
10 changed files with 102 additions and 57 deletions
+2 -3
View File
@@ -203,8 +203,6 @@ void Widget::onCancel()
if (!fullscreen) ButtonBase::onCancel();
}
void Widget::update() {}
void Widget::setFullscreen(bool enable)
{
if (!!parent->isTopBar() || (enable == fullscreen)) return;
@@ -252,7 +250,8 @@ void Widget::setFullscreen(bool enable)
onFullscreen(enable);
update();
if (fullscreen)
updateWithoutRefresh();
}
bool Widget::onLongPress()
+2 -1
View File
@@ -106,7 +106,8 @@ class Widget : public ButtonBase
virtual bool enableFullScreenRE() const { return true; }
// Called when the widget options have changed
virtual void update();
virtual void updateWithoutRefresh() {}
virtual void update() {}
// Called at regular time interval if the widget is hidden or off screen
virtual void background() {}
@@ -220,6 +220,6 @@ WidgetSettings::WidgetSettings(Widget* w) :
void WidgetSettings::onCancel()
{
widget->update();
widget->updateWithoutRefresh();
deleteLater();
}
+2 -2
View File
@@ -196,8 +196,8 @@ void StandaloneLuaWindow::deleteLater()
{
if (_deleted) return;
if (initFunction != LUA_REFNIL) luaL_unref(lsStandalone, LUA_REGISTRYINDEX, initFunction);
if (runFunction != LUA_REFNIL) luaL_unref(lsStandalone, LUA_REGISTRYINDEX, runFunction);
luaL_unref(lsStandalone, LUA_REGISTRYINDEX, initFunction);
luaL_unref(lsStandalone, LUA_REGISTRYINDEX, runFunction);
luaLcdBuffer = nullptr;
luaClose(&lsStandalone);