mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fixed a large memory leak when reloading the system view.
This commit is contained in:
parent
d3d57ae69a
commit
7b76aa005f
|
@ -35,6 +35,16 @@ SystemView::SystemView(
|
|||
populate();
|
||||
}
|
||||
|
||||
SystemView::~SystemView()
|
||||
{
|
||||
// Delete any existing extras.
|
||||
for (auto entry : mEntries) {
|
||||
for (auto extra : entry.data.backgroundExtras)
|
||||
delete extra;
|
||||
entry.data.backgroundExtras.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SystemView::populate()
|
||||
{
|
||||
mEntries.clear();
|
||||
|
@ -110,10 +120,6 @@ void SystemView::populate()
|
|||
|
||||
Vector2f denormalized = mCarousel.logoSize * e.data.logo->getOrigin();
|
||||
e.data.logo->setPosition(denormalized.x(), denormalized.y(), 0.0);
|
||||
// Delete any existing extras.
|
||||
for (auto extra : e.data.backgroundExtras)
|
||||
delete extra;
|
||||
e.data.backgroundExtras.clear();
|
||||
|
||||
// Make background extras.
|
||||
e.data.backgroundExtras = ThemeData::makeExtras((*it)->getTheme(), "system", mWindow);
|
||||
|
|
|
@ -52,6 +52,7 @@ class SystemView : public IList<SystemViewData, SystemData*>
|
|||
{
|
||||
public:
|
||||
SystemView(Window* window);
|
||||
~SystemView();
|
||||
|
||||
virtual void onShow() override;
|
||||
virtual void onHide() override;
|
||||
|
|
|
@ -43,6 +43,7 @@ ISimpleGameListView::ISimpleGameListView(
|
|||
|
||||
ISimpleGameListView::~ISimpleGameListView()
|
||||
{
|
||||
// Remove theme extras.
|
||||
for (auto extra : mThemeExtras) {
|
||||
removeChild(extra);
|
||||
delete extra;
|
||||
|
|
|
@ -213,7 +213,7 @@ std::vector<std::string> getFallbackFontPaths()
|
|||
{
|
||||
std::vector<std::string> fontPaths;
|
||||
|
||||
// Standard fonts, let's include them here for error checking purposes even though that's
|
||||
// Standard fonts, let's include them here for exception handling purposes even though that's
|
||||
// not really the correct location. (The application will crash if they are missing.)
|
||||
ResourceManager::getInstance()->
|
||||
getResourcePath(":/fonts/opensans_hebrew_condensed_light.ttf");
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
std::shared_ptr<TextureData> add(const TextureResource* key, bool tiled);
|
||||
|
||||
// The texturedata being removed may be loading in a different thread. However it will
|
||||
// be referenced by a smart point so we only need to remove it from our array and it
|
||||
// be referenced by a smart pointer so we only need to remove it from our array and it
|
||||
// will be deleted when the other thread has finished with it.
|
||||
void remove(const TextureResource* key);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path, b
|
|||
|
||||
// Is it an SVG?
|
||||
if (key.first.substr(key.first.size() - 4, std::string::npos) != ".svg") {
|
||||
// Probably not. Add it to our map. We don't add SVGs because 2 svgs might be
|
||||
// Probably not. Add it to our map. We don't add SVGs because 2 SVGs might be
|
||||
// rasterized at different sizes.
|
||||
sTextureMap[key] = std::weak_ptr<TextureResource>(tex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue