mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
finally properly implemented destructor
This commit is contained in:
parent
2b8c95d2ef
commit
39f67cfcdf
|
@ -20,8 +20,9 @@ class VideoComponent;
|
||||||
class VideoGameListView : public BasicGameListView
|
class VideoGameListView : public BasicGameListView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VideoGameListView(Window* window, FileData* root);
|
VideoGameListView(Window *window, FileData *root);
|
||||||
virtual ~VideoGameListView();
|
|
||||||
|
virtual ~VideoGameListView() noexcept;
|
||||||
|
|
||||||
virtual void onShow() override;
|
virtual void onShow() override;
|
||||||
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) override;
|
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) override;
|
||||||
|
|
|
@ -18,6 +18,7 @@ const std::vector<std::string> BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_CO
|
||||||
SLOT_ALTERNATIVE_EMULATOR};
|
SLOT_ALTERNATIVE_EMULATOR};
|
||||||
std::map<std::string, std::string> BadgesComponent::mBadgeIcons = std::map<std::string, std::string>();
|
std::map<std::string, std::string> BadgesComponent::mBadgeIcons = std::map<std::string, std::string>();
|
||||||
std::map<std::string, ImageComponent> BadgesComponent::mImageComponents = std::map<std::string, ImageComponent>();
|
std::map<std::string, ImageComponent> BadgesComponent::mImageComponents = std::map<std::string, ImageComponent>();
|
||||||
|
std::vector<BadgesComponent *> BadgesComponent::mInstances = {};
|
||||||
|
|
||||||
BadgesComponent::BadgesComponent(Window *window)
|
BadgesComponent::BadgesComponent(Window *window)
|
||||||
: FlexboxComponent(window) {
|
: FlexboxComponent(window) {
|
||||||
|
@ -48,12 +49,19 @@ BadgesComponent::BadgesComponent(Window *window)
|
||||||
mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true);
|
mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true);
|
||||||
mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu});
|
mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInstances.push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
BadgesComponent::~BadgesComponent() {
|
BadgesComponent::~BadgesComponent() noexcept {
|
||||||
mChildren.clear();
|
for (GuiComponent *c: mChildren)
|
||||||
mBadgeIcons.clear();
|
c->clearChildren();
|
||||||
mImageComponents.clear();
|
clearChildren();
|
||||||
|
mInstances.erase(std::remove(mInstances.begin(), mInstances.end(), this), mInstances.end());
|
||||||
|
if (mInstances.empty()) {
|
||||||
|
mBadgeIcons.clear();
|
||||||
|
mImageComponents.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ class BadgesComponent : public FlexboxComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BadgesComponent(Window *window);
|
BadgesComponent(Window *window);
|
||||||
|
|
||||||
~BadgesComponent() noexcept;
|
~BadgesComponent() noexcept;
|
||||||
|
|
||||||
std::string getValue() const override;
|
std::string getValue() const override;
|
||||||
|
@ -46,6 +45,7 @@ private:
|
||||||
static const std::vector<std::string> mSlots;
|
static const std::vector<std::string> mSlots;
|
||||||
static std::map<std::string, std::string> mBadgeIcons;
|
static std::map<std::string, std::string> mBadgeIcons;
|
||||||
static std::map<std::string, ImageComponent> mImageComponents;
|
static std::map<std::string, ImageComponent> mImageComponents;
|
||||||
|
static std::vector<BadgesComponent *> mInstances;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ES_APP_COMPONENTS_BADGES_COMPONENT_H
|
#endif // ES_APP_COMPONENTS_BADGES_COMPONENT_H
|
||||||
|
|
Loading…
Reference in a new issue