mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Fixed a small memory leak in GuiScraperMenu related to the retry sliders
This commit is contained in:
parent
a4911246a2
commit
f89c31d29e
|
@ -14,7 +14,6 @@
|
|||
#include "FileSorts.h"
|
||||
#include "SystemData.h"
|
||||
#include "components/OptionListComponent.h"
|
||||
#include "components/SliderComponent.h"
|
||||
#include "components/SwitchComponent.h"
|
||||
#include "guis/GuiMsgBox.h"
|
||||
#include "guis/GuiOfflineGenerator.h"
|
||||
|
@ -867,15 +866,16 @@ void GuiScraperMenu::openOtherOptions()
|
|||
}
|
||||
|
||||
// Automatic retries on error.
|
||||
auto scraperRetryOnErrorCount = std::make_shared<SliderComponent>(0.0f, 10.0f, 1.0f);
|
||||
scraperRetryOnErrorCount->setValue(
|
||||
mScraperRetryOnErrorCount = std::make_shared<SliderComponent>(0.0f, 10.0f, 1.0f);
|
||||
mScraperRetryOnErrorCount->setValue(
|
||||
static_cast<float>(Settings::getInstance()->getInt("ScraperRetryOnErrorCount")));
|
||||
s->addWithLabel("AUTOMATIC RETRIES ON ERROR", scraperRetryOnErrorCount);
|
||||
s->addSaveFunc([scraperRetryOnErrorCount, s] {
|
||||
if (scraperRetryOnErrorCount->getValue() !=
|
||||
s->addWithLabel("AUTOMATIC RETRIES ON ERROR", mScraperRetryOnErrorCount);
|
||||
s->addSaveFunc([this, s] {
|
||||
if (mScraperRetryOnErrorCount->getValue() !=
|
||||
static_cast<float>(Settings::getInstance()->getInt("ScraperRetryOnErrorCount"))) {
|
||||
Settings::getInstance()->setInt("ScraperRetryOnErrorCount",
|
||||
static_cast<int>(scraperRetryOnErrorCount->getValue()));
|
||||
Settings::getInstance()->setInt(
|
||||
"ScraperRetryOnErrorCount",
|
||||
static_cast<int>(mScraperRetryOnErrorCount->getValue()));
|
||||
s->setNeedsSaving();
|
||||
}
|
||||
});
|
||||
|
@ -894,7 +894,7 @@ void GuiScraperMenu::openOtherOptions()
|
|||
}
|
||||
});
|
||||
|
||||
if (scraperRetryOnErrorCount->getValue() == 0.0f) {
|
||||
if (mScraperRetryOnErrorCount->getValue() == 0.0f) {
|
||||
scraperRetryOnErrorTimer->setEnabled(false);
|
||||
scraperRetryOnErrorTimer->setOpacity(DISABLED_OPACITY);
|
||||
scraperRetryOnErrorTimer->getParent()
|
||||
|
@ -1087,8 +1087,8 @@ void GuiScraperMenu::openOtherOptions()
|
|||
}
|
||||
|
||||
// Slider callback.
|
||||
auto scraperRetryCountFunc = [scraperRetryOnErrorCount, scraperRetryOnErrorTimer]() {
|
||||
if (scraperRetryOnErrorCount->getValue() == 0.0f) {
|
||||
auto scraperRetryCountFunc = [this, scraperRetryOnErrorTimer]() {
|
||||
if (mScraperRetryOnErrorCount->getValue() == 0.0f) {
|
||||
scraperRetryOnErrorTimer->setEnabled(false);
|
||||
scraperRetryOnErrorTimer->setOpacity(DISABLED_OPACITY);
|
||||
scraperRetryOnErrorTimer->getParent()
|
||||
|
@ -1139,7 +1139,7 @@ void GuiScraperMenu::openOtherOptions()
|
|||
}
|
||||
};
|
||||
|
||||
scraperRetryOnErrorCount->setCallback(scraperRetryCountFunc);
|
||||
mScraperRetryOnErrorCount->setCallback(scraperRetryCountFunc);
|
||||
scraperInteractive->setCallback(interactiveToggleFunc);
|
||||
scraperRespectExclusions->setCallback(excludeRecursivelyToggleFunc);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#define ES_APP_GUIS_GUI_SCRAPER_MENU_H
|
||||
|
||||
#include "components/MenuComponent.h"
|
||||
#include "components/SliderComponent.h"
|
||||
#include "guis/GuiSettings.h"
|
||||
#include "scrapers/Scraper.h"
|
||||
#include "views/ViewController.h"
|
||||
|
@ -54,6 +55,7 @@ private:
|
|||
std::shared_ptr<OptionListComponent<std::string>> mScraper;
|
||||
std::shared_ptr<OptionListComponent<GameFilterFunc>> mFilters;
|
||||
std::shared_ptr<OptionListComponent<SystemData*>> mSystems;
|
||||
std::shared_ptr<SliderComponent> mScraperRetryOnErrorCount;
|
||||
|
||||
MenuComponent mMenu;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue