M module-apps/application-settings/windows/network/SimCardsWindow.cpp => module-apps/application-settings/windows/network/SimCardsWindow.cpp +6 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "SimCardsWindow.hpp"
@@ 15,6 15,11 @@ namespace gui
: BaseSettingsWindow(app, gui::window::name::sim_cards), simParams(simParams)
{}
+ SimCardsWindow::~SimCardsWindow()
+ {
+ destroyForTheFuture();
+ }
+
void SimCardsWindow::onBeforeShow(ShowMode mode, SwitchData *data)
{
setTitle(utils::translate("app_settings_network_sim_cards"));
M module-apps/application-settings/windows/network/SimCardsWindow.hpp => module-apps/application-settings/windows/network/SimCardsWindow.hpp +2 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 20,6 20,7 @@ namespace gui
public:
SimCardsWindow(app::ApplicationCommon *app, app::settingsInterface::SimParams *simParams);
+ ~SimCardsWindow();
void onBeforeShow(ShowMode mode, SwitchData *data) override;
};
M module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp => module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp +6 -1
@@ 23,6 23,11 @@ namespace gui
changeDateAndTimeWindow = window::name::change_date_and_time;
}
+ DateAndTimeMainWindow::~DateAndTimeMainWindow()
+ {
+ destroyForTheFuture();
+ }
+
auto DateAndTimeMainWindow::buildOptionsList() -> std::list<Option>
{
std::list<Option> optionList;
@@ 38,7 43,7 @@ namespace gui
optionList.emplace_back(std::make_unique<option::OptionSettings>(
text,
activatedCallback,
- [=](Item &item) { return navBarCallback(item); },
+ [this](Item &item) { return navBarCallback(item); },
nullptr,
rightItem,
false,
M module-apps/application-settings/windows/system/DateAndTimeMainWindow.hpp => module-apps/application-settings/windows/system/DateAndTimeMainWindow.hpp +2 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 13,6 13,7 @@ namespace gui
{
public:
DateAndTimeMainWindow(app::ApplicationCommon *app, std::string name);
+ ~DateAndTimeMainWindow();
protected:
auto buildOptionsList() -> std::list<Option> override;
M module-apps/apps-common/WindowsStack.cpp => module-apps/apps-common/WindowsStack.cpp +2 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "WindowsStack.hpp"
@@ 23,6 23,7 @@ namespace app
std::unique_ptr<gui::AppWindow> window,
const gui::popup::Disposition &disposition)
{
+ /// Note: this is the place which will destroy old window if there was one
windows[name] = std::move(window);
stack.push_back(WindowData(name, disposition));
}
M module-apps/apps-common/windows/OptionWindow.cpp => module-apps/apps-common/windows/OptionWindow.cpp +6 -0
@@ 68,4 68,10 @@ namespace gui
optionsList->rebuildList(listview::RebuildType::InPlace);
}
+ void OptionWindow::destroyForTheFuture()
+ {
+ erase(optionsList);
+ optionsList = nullptr;
+ }
+
} /* namespace gui */
M module-apps/apps-common/windows/OptionWindow.hpp => module-apps/apps-common/windows/OptionWindow.hpp +7 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 31,5 31,11 @@ namespace gui
void onClose(CloseReason reason) override;
void rebuild() override;
void buildInterface() override;
+
+ protected:
+ /// this have to be called in inheriting window if someone passes callback to it
+ /// othervise destruction order will cause call to non existing parent element
+ /// this is because on how OptionWindows are designed
+ void destroyForTheFuture();
};
}; // namespace gui