[Scummvm-cvs-logs] SF.net SVN: scummvm:[48626] scummvm/trunk/engines
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Apr 11 20:31:02 CEST 2010
Revision: 48626
http://scummvm.svn.sourceforge.net/scummvm/?rev=48626&view=rev
Author: lordhoto
Date: 2010-04-11 18:30:42 +0000 (Sun, 11 Apr 2010)
Log Message:
-----------
Setup and destroy a dummy cursor and palette in the Engine class.
The idea behind this is exactly the same as behind r48620,
but it affects all engines, thus engine authors can now use
CursorMan.replaceCursor without having to worry about possible
memory leaks or the like.
Modified Paths:
--------------
scummvm/trunk/engines/engine.cpp
scummvm/trunk/engines/kyra/screen.cpp
scummvm/trunk/engines/scumm/scumm.cpp
Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp 2010-04-11 18:09:12 UTC (rev 48625)
+++ scummvm/trunk/engines/engine.cpp 2010-04-11 18:30:42 UTC (rev 48626)
@@ -30,6 +30,9 @@
#endif
#include "engines/engine.h"
+#include "engines/dialogs.h"
+#include "engines/metaengine.h"
+
#include "common/config-manager.h"
#include "common/debug.h"
#include "common/events.h"
@@ -37,13 +40,15 @@
#include "common/timer.h"
#include "common/savefile.h"
#include "common/system.h"
+
#include "gui/debugger.h"
#include "gui/message.h"
#include "gui/GuiManager.h"
+
#include "sound/mixer.h"
-#include "engines/dialogs.h"
-#include "engines/metaengine.h"
+#include "graphics/cursorman.h"
+
#ifdef _WIN32_WCE
extern bool isSmartphone();
#endif
@@ -103,6 +108,14 @@
// freed. Of course, there still would be problems with many games...
if (!_mixer->isReady())
warning("Sound initialization failed. This may cause severe problems in some games.");
+
+ // Setup a dummy cursor and palette, so that all engines can use CursorMan.replace
+ // without having any headaches about memory leaks. Check commit log of r48620 for
+ // some information about this.
+ CursorMan.pushCursor(NULL, 0, 0, 0, 0, 0);
+ // Note: Using this dummy palette will actually disable cursor palettes till the
+ // user enables it again.
+ CursorMan.pushCursorPalette(NULL, 0, 0);
}
Engine::~Engine() {
@@ -110,6 +123,10 @@
delete _mainMenuDialog;
g_engine = NULL;
+
+ // Remove our cursors again to prevent memory leaks
+ CursorMan.popCursor();
+ CursorMan.popCursorPalette();
}
void initCommonGFX(bool defaultTo1XScaler) {
Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp 2010-04-11 18:09:12 UTC (rev 48625)
+++ scummvm/trunk/engines/kyra/screen.cpp 2010-04-11 18:30:42 UTC (rev 48626)
@@ -69,8 +69,6 @@
for (uint i = 0; i < _palettes.size(); ++i)
delete _palettes[i];
-
- CursorMan.popCursor();
}
bool Screen::init() {
@@ -158,7 +156,6 @@
_animBlockPtr = NULL;
_animBlockSize = 0;
_mouseLockCount = 1;
- CursorMan.pushCursor(NULL, 0, 0, 0, 0, 0);
CursorMan.showMouse(false);
_forceFullUpdate = false;
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2010-04-11 18:09:12 UTC (rev 48625)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2010-04-11 18:30:42 UTC (rev 48626)
@@ -550,12 +550,6 @@
Common::addDebugChannel(debugChannels[i].flag, debugChannels[i].channel, debugChannels[i].desc);
g_eventRec.registerRandomSource(_rnd, "scumm");
-
- // Setup a dummy cursor and palette. The latter is only
- // required by HE, thus we might consider to do that only
- // for HE games.
- CursorMan.pushCursor(NULL, 0, 0, 0, 0, 0);
- CursorMan.pushCursorPalette(NULL, 0, 0);
}
@@ -612,10 +606,6 @@
delete _res;
delete _gdi;
-
- // Remove our cursors again to prevent memory leaks
- CursorMan.popCursor();
- CursorMan.popCursorPalette();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list