[Scummvm-git-logs] scummvm master -> bd3f1574648732f7f22f7e8ce74de624c93d129c
bgK
bastien.bouclet at gmail.com
Sun Nov 10 20:17:01 CET 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bd3f157464 GUI: Fix memory leak in the about dialog
Commit: bd3f1574648732f7f22f7e8ce74de624c93d129c
https://github.com/scummvm/scummvm/commit/bd3f1574648732f7f22f7e8ce74de624c93d129c
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-11-10T20:05:04+01:00
Commit Message:
GUI: Fix memory leak in the about dialog
Also don't eagerly allocate EE as it consumes quite a bit of memory.
Changed paths:
gui/about.cpp
diff --git a/gui/about.cpp b/gui/about.cpp
index eaafadb..6549732 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -38,13 +38,7 @@ class EE;
class EEHandler {
public:
- EEHandler();
- ~EEHandler();
-
bool handleKeyDown(Common::KeyState &state);
-
-private:
- EE *_ee;
};
enum {
@@ -146,8 +140,6 @@ AboutDialog::AboutDialog()
for (i = 0; i < ARRAYSIZE(credits); i++)
addLine(credits[i]);
-
- _eeHandler = new EEHandler;
}
void AboutDialog::addLine(const char *str) {
@@ -296,7 +288,9 @@ void AboutDialog::handleMouseUp(int x, int y, int button, int clickCount) {
}
void AboutDialog::handleKeyDown(Common::KeyState state) {
- if (_eeHandler->handleKeyDown(state)) {
+ EEHandler eeHandler;
+
+ if (eeHandler.handleKeyDown(state)) {
reflowLayout();
return;
}
@@ -430,17 +424,11 @@ private:
void drawStatus(Common::String str, int x, uint32 color, int y = 0, int color2 = 0, int w = 16);
};
-EEHandler::EEHandler() {
- _ee = new EE;
-}
-
-EEHandler::~EEHandler() {
- delete _ee;
-}
-
bool EEHandler::handleKeyDown(Common::KeyState &state) {
if (state.ascii == 'v') {
- _ee->run();
+ EE *ee = new EE();
+ ee->run();
+ delete ee;
g_gui.redrawFull();
More information about the Scummvm-git-logs
mailing list