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
This commit is contained in:
stephena 2005-05-08 17:38:23 +00:00
parent cf08dc29cd
commit 16ee1f8e7f
5 changed files with 16 additions and 29 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <algorithm> #include <algorithm>
@ -591,17 +591,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
myOSystem->sound().mute(myPauseFlag); myOSystem->sound().mute(myPauseFlag);
return; 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) else if(event == Event::LauncherMode)
{ {
// ExitGame will only work when we've launched stella using the ROM // ExitGame will only work when we've launched stella using the ROM

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <sstream> #include <sstream>
@ -38,8 +38,8 @@
FrameBuffer::FrameBuffer(OSystem* osystem) FrameBuffer::FrameBuffer(OSystem* osystem)
: myOSystem(osystem), : myOSystem(osystem),
theRedrawEntireFrameIndicator(true), theRedrawEntireFrameIndicator(true),
theZoomLevel(1), theZoomLevel(2),
theMaxZoomLevel(1), theMaxZoomLevel(2),
theAspectRatio(1.0), theAspectRatio(1.0),
theUseAspectRatioFlag(true), theUseAspectRatioFlag(true),
myFrameRate(0), myFrameRate(0),
@ -345,7 +345,7 @@ void FrameBuffer::resize(Size size, Int8 zoom)
return; return;
// Update the settings // Update the settings
myOSystem->settings().setInt("zoom", theZoomLevel); // myOSystem->settings().setInt("zoom", theZoomLevel);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef FRAMEBUFFER_HXX
@ -41,7 +41,7 @@ class OSystem;
All GUI elements (ala ScummVM) are drawn here as well. All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony @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 class FrameBuffer
{ {
@ -135,7 +135,7 @@ class FrameBuffer
*/ */
void refresh(bool now = false) void refresh(bool now = false)
{ {
// cerr << "refresh() " << myNumRedraws++ << endl; //cerr << "refresh() " << myNumRedraws++ << endl;
theRedrawEntireFrameIndicator = true; theRedrawEntireFrameIndicator = true;
myMenuRedraws = 2; myMenuRedraws = 2;
if(now) drawMediaSource(); if(now) drawMediaSource();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <cassert> #include <cassert>
@ -120,11 +120,7 @@ bool OSystem::createFrameBuffer(bool showmessage)
} }
// Delete the old framebuffer // Delete the old framebuffer
if(myFrameBuffer) delete myFrameBuffer; myFrameBuffer = NULL;
{
delete myFrameBuffer;
myFrameBuffer = NULL;
}
// And recreate a new one // And recreate a new one
string video = mySettings->getString("video"); string video = mySettings->getString("video");
@ -194,7 +190,7 @@ void OSystem::toggleFrameBuffer()
void OSystem::createSound() void OSystem::createSound()
{ {
// Delete the old sound device // Delete the old sound device
delete mySound; delete mySound; mySound = NULL;
// And recreate a new sound device // And recreate a new sound device
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
@ -256,7 +252,7 @@ bool OSystem::createConsole(const string& romfile)
uInt32 size = in.gcount(); uInt32 size = in.gcount();
in.close(); in.close();
delete myConsole; delete myConsole; myConsole = NULL;
// Create an instance of the 2600 game console // Create an instance of the 2600 game console
// The Console c'tor takes care of updating the eventhandler state // The Console c'tor takes care of updating the eventhandler state

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -49,7 +49,9 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y,
uInt16 w, uInt16 h) uInt16 w, uInt16 h)
: Dialog(osystem, x, y, w, h) : Dialog(osystem, x, y, w, h),
myList(NULL),
myBrowser(NULL)
{ {
// Show game name // Show game name
new StaticTextWidget(this, 10, 8, _w - 20, kLineHeight, new StaticTextWidget(this, 10, 8, _w - 20, kLineHeight,