aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-05-05 20:29:37 +1000
committerPaul Gilbert2012-05-05 20:29:37 +1000
commitaa603d5a6719764e785e4bd096f16493f7ec7f6c (patch)
treeaf4cac7b6b8a2149985d354b4edba6b90a687eb9
parentfbee927c6a648ee1e3f162f0ec6b9d298619dd9f (diff)
downloadscummvm-rg350-aa603d5a6719764e785e4bd096f16493f7ec7f6c.tar.gz
scummvm-rg350-aa603d5a6719764e785e4bd096f16493f7ec7f6c.tar.bz2
scummvm-rg350-aa603d5a6719764e785e4bd096f16493f7ec7f6c.zip
TONY: Fix a crash from objects being destroyed in the wrong order
-rw-r--r--engines/tony/tony.cpp1
-rw-r--r--engines/tony/tony.h3
-rw-r--r--engines/tony/window.cpp11
-rw-r--r--engines/tony/window.h4
4 files changed, 13 insertions, 6 deletions
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index f4e2f9f1c6..457ba57153 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -410,7 +410,6 @@ void TonyEngine::Close(void) {
CloseMusic();
CloseHandle(m_hEndOfFrame);
_theBoxes.Close();
- RMText::Unload();
_theEngine.Close();
m_wnd.Close();
delete[] m_curThumbnail;
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
index 51cfdf74f3..c64bc884d6 100644
--- a/engines/tony/tony.h
+++ b/engines/tony/tony.h
@@ -108,7 +108,6 @@ public:
FPSTREAM *m_stream[6];
FPSFX *m_sfx[MAX_SFX_CHANNELS];
FPSFX *m_utilSfx[MAX_SFX_CHANNELS];
- RMGfxEngine theEngine;
RMFont *fonts[2];
bool m_bPaused;
bool m_bDrawLocation;
@@ -117,8 +116,8 @@ public:
// Bounding box list manager
RMGameBoxes _theBoxes;
- RMGfxEngine _theEngine;
RMWindow m_wnd;
+ RMGfxEngine _theEngine;
bool m_bQuitNow;
bool m_bTimeFreezed;
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index 41821ccacc..ae8d3612c3 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -57,9 +57,18 @@ namespace Tony {
static uint16 m_wPrecalcTable[0x10000];
/****************************************************************************\
-* Metodi di RMWindow
+* RMWindow Methods
\****************************************************************************/
+RMWindow::RMWindow() {
+ m_Primary = NULL; m_Back = NULL;
+}
+
+RMWindow::~RMWindow() {
+ Close();
+ RMText::Unload();
+}
+
#ifdef REFACTOR_ME
LRESULT CALLBACK GlobalWindowProc(HWND hWnd, uint32 msg, uint16 wParam, int32 lParam) {
if ((HWND)theGame.m_wnd == NULL)
diff --git a/engines/tony/window.h b/engines/tony/window.h
index da8c5dc824..5949450e8f 100644
--- a/engines/tony/window.h
+++ b/engines/tony/window.h
@@ -121,8 +121,8 @@ protected:
void WipeEffect(Common::Rect &rcBoundEllipse);
public:
- RMWindow() { m_Primary = NULL; m_Back = NULL; };
- ~RMWindow() { Close(); }
+ RMWindow();
+ ~RMWindow();
// Inizializzazione
void Init(/*HINSTANCE hInst*/);