mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-31 04:25:40 +00:00
Fixed a memory leak related to the gamelist placeholders.
This commit is contained in:
parent
924b3ac033
commit
90e3fe0fac
|
@ -47,7 +47,8 @@ SystemData::SystemData(
|
|||
mIsCustomCollectionSystem(CustomCollectionSystem),
|
||||
mIsGroupedCustomCollectionSystem(false),
|
||||
mIsGameSystem(true),
|
||||
mScrapeFlag(false)
|
||||
mScrapeFlag(false),
|
||||
mPlaceholder(nullptr)
|
||||
{
|
||||
mFilterIndex = new FileFilterIndex();
|
||||
|
||||
|
@ -79,6 +80,10 @@ SystemData::SystemData(
|
|||
mRootFolder = new FileData(FOLDER, "" + name, mEnvData, this);
|
||||
setupSystemSortType(mRootFolder);
|
||||
}
|
||||
|
||||
// This placeholder can be used later in the gamelist view.
|
||||
mPlaceholder = new FileData(PLACEHOLDER, "<No Entries Found>", getSystemEnvData(), this);
|
||||
|
||||
setIsGameSystemStatus();
|
||||
loadTheme();
|
||||
}
|
||||
|
@ -93,6 +98,7 @@ SystemData::~SystemData()
|
|||
if (!mEnvData->mStartPath.empty())
|
||||
delete mEnvData;
|
||||
delete mRootFolder;
|
||||
delete mPlaceholder;
|
||||
delete mFilterIndex;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
SystemData* getPrev() const;
|
||||
static SystemData* getRandomSystem(const SystemData* currentSystem);
|
||||
FileData* getRandomGame(const FileData* currentGame = nullptr);
|
||||
FileData* getPlaceholder() { return mPlaceholder; };
|
||||
|
||||
void sortSystem(bool reloadGamelist = true, bool jumpToFirstRow = false);
|
||||
|
||||
|
@ -127,6 +128,7 @@ private:
|
|||
FileFilterIndex* mFilterIndex;
|
||||
|
||||
FileData* mRootFolder;
|
||||
FileData* mPlaceholder;
|
||||
};
|
||||
|
||||
#endif // ES_APP_SYSTEM_DATA_H
|
||||
|
|
|
@ -162,15 +162,14 @@ FileData* BasicGameListView::getFirstGameEntry()
|
|||
|
||||
void BasicGameListView::addPlaceholder(FileData* firstEntry)
|
||||
{
|
||||
// Empty list - add a placeholder.
|
||||
SystemData* system;
|
||||
if (firstEntry && firstEntry->getSystem()->isGroupedCustomCollection())
|
||||
system = firstEntry->getSystem();
|
||||
else
|
||||
system = this->mRoot->getSystem();
|
||||
// Empty list, add a placeholder.
|
||||
FileData* placeholder;
|
||||
|
||||
if (firstEntry && firstEntry->getSystem()->isGroupedCustomCollection())
|
||||
placeholder = firstEntry->getSystem()->getPlaceholder();
|
||||
else
|
||||
placeholder = this->mRoot->getSystem()->getPlaceholder();
|
||||
|
||||
FileData* placeholder = new FileData(PLACEHOLDER, "<No Entries Found>",
|
||||
this->mRoot->getSystem()->getSystemEnvData(), system);
|
||||
mList.add(placeholder->getName(), placeholder, (placeholder->getType() == PLACEHOLDER));
|
||||
}
|
||||
|
||||
|
|
|
@ -535,15 +535,14 @@ void GridGameListView::updateInfoPanel()
|
|||
|
||||
void GridGameListView::addPlaceholder(FileData* firstEntry)
|
||||
{
|
||||
// Empty list - add a placeholder.
|
||||
SystemData* system;
|
||||
if (firstEntry && firstEntry->getSystem()->isGroupedCustomCollection())
|
||||
system = firstEntry->getSystem();
|
||||
else
|
||||
system = this->mRoot->getSystem();
|
||||
// Empty list, add a placeholder.
|
||||
FileData* placeholder;
|
||||
|
||||
if (firstEntry && firstEntry->getSystem()->isGroupedCustomCollection())
|
||||
placeholder = firstEntry->getSystem()->getPlaceholder();
|
||||
else
|
||||
placeholder = this->mRoot->getSystem()->getPlaceholder();
|
||||
|
||||
FileData* placeholder = new FileData(PLACEHOLDER, "<No Entries Found>",
|
||||
this->mRoot->getSystem()->getSystemEnvData(), system);
|
||||
mGrid.add(placeholder->getName(), "", placeholder);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue