Fixed memory leak: widget factories need to be deleted
in opentxClose()
This commit is contained in:
@@ -187,6 +187,9 @@ void registerBitmapClass(lua_State * L);
|
||||
void luaSetInstructionsLimit(lua_State* L, int count);
|
||||
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
|
||||
|
||||
// Unregister LUA widget factories
|
||||
void luaUnregisterWidgets();
|
||||
|
||||
#if LCD_W > 350
|
||||
#define RADIO_TOOL_NAME_MAXLEN 40
|
||||
#else
|
||||
|
||||
@@ -512,3 +512,13 @@ void luaInitThemesAndWidgets()
|
||||
luaDoGc(lsWidgets, true);
|
||||
}
|
||||
}
|
||||
|
||||
void luaUnregisterWidgets()
|
||||
{
|
||||
std::list<const WidgetFactory *> regWidgets(getRegisteredWidgets());
|
||||
for (auto w : regWidgets) {
|
||||
if (dynamic_cast<const LuaWidgetFactory*>(w)) {
|
||||
delete w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user