TONY: Fix a crash from objects being destroyed in the wrong order

This commit is contained in:
Paul Gilbert 2012-05-05 20:29:37 +10:00
parent fbee927c6a
commit aa603d5a67
4 changed files with 13 additions and 6 deletions

View file

@ -410,7 +410,6 @@ void TonyEngine::Close(void) {
CloseMusic(); CloseMusic();
CloseHandle(m_hEndOfFrame); CloseHandle(m_hEndOfFrame);
_theBoxes.Close(); _theBoxes.Close();
RMText::Unload();
_theEngine.Close(); _theEngine.Close();
m_wnd.Close(); m_wnd.Close();
delete[] m_curThumbnail; delete[] m_curThumbnail;

View file

@ -108,7 +108,6 @@ public:
FPSTREAM *m_stream[6]; FPSTREAM *m_stream[6];
FPSFX *m_sfx[MAX_SFX_CHANNELS]; FPSFX *m_sfx[MAX_SFX_CHANNELS];
FPSFX *m_utilSfx[MAX_SFX_CHANNELS]; FPSFX *m_utilSfx[MAX_SFX_CHANNELS];
RMGfxEngine theEngine;
RMFont *fonts[2]; RMFont *fonts[2];
bool m_bPaused; bool m_bPaused;
bool m_bDrawLocation; bool m_bDrawLocation;
@ -117,8 +116,8 @@ public:
// Bounding box list manager // Bounding box list manager
RMGameBoxes _theBoxes; RMGameBoxes _theBoxes;
RMGfxEngine _theEngine;
RMWindow m_wnd; RMWindow m_wnd;
RMGfxEngine _theEngine;
bool m_bQuitNow; bool m_bQuitNow;
bool m_bTimeFreezed; bool m_bTimeFreezed;

View file

@ -57,9 +57,18 @@ namespace Tony {
static uint16 m_wPrecalcTable[0x10000]; 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 #ifdef REFACTOR_ME
LRESULT CALLBACK GlobalWindowProc(HWND hWnd, uint32 msg, uint16 wParam, int32 lParam) { LRESULT CALLBACK GlobalWindowProc(HWND hWnd, uint32 msg, uint16 wParam, int32 lParam) {
if ((HWND)theGame.m_wnd == NULL) if ((HWND)theGame.m_wnd == NULL)

View file

@ -121,8 +121,8 @@ protected:
void WipeEffect(Common::Rect &rcBoundEllipse); void WipeEffect(Common::Rect &rcBoundEllipse);
public: public:
RMWindow() { m_Primary = NULL; m_Back = NULL; }; RMWindow();
~RMWindow() { Close(); } ~RMWindow();
// Inizializzazione // Inizializzazione
void Init(/*HINSTANCE hInst*/); void Init(/*HINSTANCE hInst*/);