From 16ee1f8e7f537b769a69d2a3bbfccadea4c60737 Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 8 May 2005 17:38:23 +0000 Subject: [PATCH] Fixed some uninitialized pointers that were causing segfaults at strange times. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@414 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/EventHandler.cxx | 13 +------------ stella/src/emucore/FrameBuffer.cxx | 8 ++++---- stella/src/emucore/FrameBuffer.hxx | 6 +++--- stella/src/emucore/OSystem.cxx | 12 ++++-------- stella/src/gui/LauncherDialog.cxx | 6 ++++-- 5 files changed, 16 insertions(+), 29 deletions(-) diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index c3f2ca0a6..84add58a3 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventHandler.cxx,v 1.53 2005-05-06 22:50:15 stephena Exp $ +// $Id: EventHandler.cxx,v 1.54 2005-05-08 17:38:23 stephena Exp $ //============================================================================ #include @@ -591,17 +591,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 state) myOSystem->sound().mute(myPauseFlag); return; } - else if(event == Event::MenuMode) - { - // ExitGame will only work when we've launched stella using the ROM - // launcher. Otherwise, the only way to exit the main loop is to Quit. - if(myState == S_EMULATE && myUseLauncherFlag) - { - myOSystem->settings().saveConfig(); - myOSystem->createLauncher(); - return; - } - } else if(event == Event::LauncherMode) { // ExitGame will only work when we've launched stella using the ROM diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 1e9bb08db..2f5c197f3 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBuffer.cxx,v 1.33 2005-05-06 22:50:15 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.34 2005-05-08 17:38:23 stephena Exp $ //============================================================================ #include @@ -38,8 +38,8 @@ FrameBuffer::FrameBuffer(OSystem* osystem) : myOSystem(osystem), theRedrawEntireFrameIndicator(true), - theZoomLevel(1), - theMaxZoomLevel(1), + theZoomLevel(2), + theMaxZoomLevel(2), theAspectRatio(1.0), theUseAspectRatioFlag(true), myFrameRate(0), @@ -345,7 +345,7 @@ void FrameBuffer::resize(Size size, Int8 zoom) return; // Update the settings - myOSystem->settings().setInt("zoom", theZoomLevel); +// myOSystem->settings().setInt("zoom", theZoomLevel); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index 09a10a9fd..a1e6261cb 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBuffer.hxx,v 1.29 2005-05-06 22:50:15 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.30 2005-05-08 17:38:23 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -41,7 +41,7 @@ class OSystem; All GUI elements (ala ScummVM) are drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.29 2005-05-06 22:50:15 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.30 2005-05-08 17:38:23 stephena Exp $ */ class FrameBuffer { @@ -135,7 +135,7 @@ class FrameBuffer */ void refresh(bool now = false) { - // cerr << "refresh() " << myNumRedraws++ << endl; + //cerr << "refresh() " << myNumRedraws++ << endl; theRedrawEntireFrameIndicator = true; myMenuRedraws = 2; if(now) drawMediaSource(); diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 638371bdc..726610d71 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.12 2005-05-06 22:50:15 stephena Exp $ +// $Id: OSystem.cxx,v 1.13 2005-05-08 17:38:23 stephena Exp $ //============================================================================ #include @@ -120,11 +120,7 @@ bool OSystem::createFrameBuffer(bool showmessage) } // Delete the old framebuffer - if(myFrameBuffer) - { - delete myFrameBuffer; - myFrameBuffer = NULL; - } + delete myFrameBuffer; myFrameBuffer = NULL; // And recreate a new one string video = mySettings->getString("video"); @@ -194,7 +190,7 @@ void OSystem::toggleFrameBuffer() void OSystem::createSound() { // Delete the old sound device - delete mySound; + delete mySound; mySound = NULL; // And recreate a new sound device #ifdef SOUND_SUPPORT @@ -256,7 +252,7 @@ bool OSystem::createConsole(const string& romfile) uInt32 size = in.gcount(); in.close(); - delete myConsole; + delete myConsole; myConsole = NULL; // Create an instance of the 2600 game console // The Console c'tor takes care of updating the eventhandler state diff --git a/stella/src/gui/LauncherDialog.cxx b/stella/src/gui/LauncherDialog.cxx index 48fe32fca..e6dd0837e 100644 --- a/stella/src/gui/LauncherDialog.cxx +++ b/stella/src/gui/LauncherDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: LauncherDialog.cxx,v 1.2 2005-05-06 22:50:15 stephena Exp $ +// $Id: LauncherDialog.cxx,v 1.3 2005-05-08 17:38:23 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -49,7 +49,9 @@ enum { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h) + : Dialog(osystem, x, y, w, h), + myList(NULL), + myBrowser(NULL) { // Show game name new StaticTextWidget(this, 10, 8, _w - 20, kLineHeight,