From 295bb0c4c4820d49c1fca7f471c7eed63440f243 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 8 Aug 2020 22:29:32 +0200 Subject: [PATCH] Fixed a memory leak where some textures were not deleted during gamelist reloads. --- es-app/src/views/gamelist/ISimpleGameListView.cpp | 9 +++++++++ es-app/src/views/gamelist/ISimpleGameListView.h | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/es-app/src/views/gamelist/ISimpleGameListView.cpp b/es-app/src/views/gamelist/ISimpleGameListView.cpp index 7a0c0fcfc..bfc082bf0 100644 --- a/es-app/src/views/gamelist/ISimpleGameListView.cpp +++ b/es-app/src/views/gamelist/ISimpleGameListView.cpp @@ -41,6 +41,15 @@ ISimpleGameListView::ISimpleGameListView( addChild(&mBackground); } +ISimpleGameListView::~ISimpleGameListView() +{ + for (auto extra : mThemeExtras) { + removeChild(extra); + delete extra; + } + mThemeExtras.clear(); +} + void ISimpleGameListView::onThemeChanged(const std::shared_ptr& theme) { using namespace ThemeFlags; diff --git a/es-app/src/views/gamelist/ISimpleGameListView.h b/es-app/src/views/gamelist/ISimpleGameListView.h index 59a53b99d..d64a54090 100644 --- a/es-app/src/views/gamelist/ISimpleGameListView.h +++ b/es-app/src/views/gamelist/ISimpleGameListView.h @@ -17,8 +17,7 @@ class ISimpleGameListView : public IGameListView { public: ISimpleGameListView(Window* window, FileData* root); - - virtual ~ISimpleGameListView() {} + virtual ~ISimpleGameListView(); // Called when a new file is added, a file is removed, a file's metadata changes, // or a file's children are sorted.