mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14: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
|
||||
{
|
||||
public:
|
||||
VideoGameListView(Window* window, FileData* root);
|
||||
virtual ~VideoGameListView();
|
||||
VideoGameListView(Window *window, FileData *root);
|
||||
|
||||
virtual ~VideoGameListView() noexcept;
|
||||
|
||||
virtual void onShow() 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};
|
||||
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::vector<BadgesComponent *> BadgesComponent::mInstances = {};
|
||||
|
||||
BadgesComponent::BadgesComponent(Window *window)
|
||||
: FlexboxComponent(window) {
|
||||
|
@ -48,12 +49,19 @@ BadgesComponent::BadgesComponent(Window *window)
|
|||
mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true);
|
||||
mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu});
|
||||
}
|
||||
|
||||
mInstances.push_back(this);
|
||||
}
|
||||
|
||||
BadgesComponent::~BadgesComponent() {
|
||||
mChildren.clear();
|
||||
mBadgeIcons.clear();
|
||||
mImageComponents.clear();
|
||||
BadgesComponent::~BadgesComponent() noexcept {
|
||||
for (GuiComponent *c: mChildren)
|
||||
c->clearChildren();
|
||||
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:
|
||||
BadgesComponent(Window *window);
|
||||
|
||||
~BadgesComponent() noexcept;
|
||||
|
||||
std::string getValue() const override;
|
||||
|
@ -46,6 +45,7 @@ private:
|
|||
static const std::vector<std::string> mSlots;
|
||||
static std::map<std::string, std::string> mBadgeIcons;
|
||||
static std::map<std::string, ImageComponent> mImageComponents;
|
||||
static std::vector<BadgesComponent *> mInstances;
|
||||
};
|
||||
|
||||
#endif // ES_APP_COMPONENTS_BADGES_COMPONENT_H
|
||||
|
|
Loading…
Reference in a new issue