mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 12:05:38 +00:00
Fixed some minor memory leaks in UIModeController, InputManager and Font.
This commit is contained in:
parent
adaec71f5b
commit
08e6f1b0dd
|
@ -26,6 +26,14 @@ UIModeController* UIModeController::getInstance()
|
|||
return sInstance;
|
||||
}
|
||||
|
||||
void UIModeController::deinit()
|
||||
{
|
||||
if (sInstance) {
|
||||
delete sInstance;
|
||||
sInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
UIModeController::UIModeController() : mPassKeyCounter(0)
|
||||
{
|
||||
mPassKeySequence = Settings::getInstance()->getString("UIMode_passkey");
|
||||
|
|
|
@ -23,6 +23,7 @@ class UIModeController
|
|||
{
|
||||
public:
|
||||
static UIModeController* getInstance();
|
||||
static void deinit();
|
||||
|
||||
// Monitor input for UI mode change, returns true (consumes input) when a UI mode
|
||||
// change is triggered.
|
||||
|
|
|
@ -83,6 +83,7 @@ ViewController::~ViewController()
|
|||
{
|
||||
assert(sInstance == this);
|
||||
sInstance = nullptr;
|
||||
UIModeController::deinit();
|
||||
}
|
||||
|
||||
void ViewController::noSystemsFileDialog()
|
||||
|
|
|
@ -174,6 +174,11 @@ void InputManager::deinit()
|
|||
|
||||
SDL_JoystickEventState(SDL_DISABLE);
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
||||
if (sInstance) {
|
||||
delete sInstance;
|
||||
sInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int InputManager::getNumJoysticks()
|
||||
|
|
|
@ -93,6 +93,17 @@ Font::Font(int size, const std::string& path) : mSize(size), mPath(path)
|
|||
Font::~Font()
|
||||
{
|
||||
unload(ResourceManager::getInstance());
|
||||
|
||||
auto fontEntry = sFontMap.find(std::pair<std::string, int>(mPath, mSize));
|
||||
|
||||
if (fontEntry != sFontMap.cend()) {
|
||||
sFontMap.erase(fontEntry);
|
||||
}
|
||||
|
||||
if (sFontMap.empty() && sLibrary) {
|
||||
FT_Done_FreeType(sLibrary);
|
||||
sLibrary = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Font::reload(std::shared_ptr<ResourceManager>& /*rm*/)
|
||||
|
|
Loading…
Reference in a new issue