Added a Dialog::reset() method, which basically makes sure that any

dialog boxes are in a known, closed state.  Simply calling Dialog::close()
on those dialog boxes *should* have done the trick, but it occasionally
results in a segfault.  My code doesn't ;)  It's probably a hack, but
it's a small and necessary one at this point.  When I eventually run Stella
through Valgrind, I'll probably find the segfault is caused by a dangling
pointer or something ...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@426 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-05-16 15:37:30 +00:00
parent 9c557fb016
commit e12d010c45
7 changed files with 39 additions and 14 deletions

View File

@ -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: Dialog.cxx,v 1.14 2005-05-13 18:28:05 stephena Exp $
// $Id: Dialog.cxx,v 1.15 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -89,6 +89,12 @@ void Dialog::close()
releaseFocus();
parent()->removeDialog();
reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::reset()
{
_openCount = 0;
}

View File

@ -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: Dialog.hxx,v 1.12 2005-05-13 18:28:05 stephena Exp $
// $Id: Dialog.hxx,v 1.13 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -35,7 +35,7 @@ class DialogContainer;
This is the base class for all dialog boxes.
@author Stephen Anthony
@version $Id: Dialog.hxx,v 1.12 2005-05-13 18:28:05 stephena Exp $
@version $Id: Dialog.hxx,v 1.13 2005-05-16 15:37:30 stephena Exp $
*/
class Dialog : public GuiObject
{
@ -51,6 +51,7 @@ class Dialog : public GuiObject
virtual void open();
virtual void close();
virtual void reset();
virtual void drawDialog();
virtual void loadConfig() {}
virtual void saveConfig() {}

View File

@ -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: DialogContainer.cxx,v 1.4 2005-05-16 00:02:32 stephena Exp $
// $Id: DialogContainer.cxx,v 1.5 2005-05-16 15:37:30 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -72,13 +72,12 @@ void DialogContainer::removeDialog()
void DialogContainer::reStack()
{
// Pop all items from the stack, and then add the base menu
Dialog* d;
while(!myDialogStack.empty())
{
d = myDialogStack.pop();
d->close();
}
myDialogStack.pop();
myDialogStack.push(myBaseDialog);
// Now make sure all dialog boxes are in a known (closed) state
myBaseDialog->reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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.13 2005-05-14 03:26:29 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.14 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -161,6 +161,12 @@ void LauncherDialog::close()
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::reset()
{
myOptions->reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::updateListing(bool fullReload)
{

View File

@ -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.hxx,v 1.6 2005-05-13 18:28:05 stephena Exp $
// $Id: LauncherDialog.hxx,v 1.7 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -46,6 +46,7 @@ class LauncherDialog : public Dialog
void updateListing(bool fullReload = false);
void close();
void reset();
void loadConfig();
protected:

View File

@ -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: OptionsDialog.cxx,v 1.17 2005-05-16 00:02:32 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.18 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -133,6 +133,17 @@ void OptionsDialog::checkBounds(int width, int height,
*y = (height - *h) / 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OptionsDialog::reset()
{
myVideoDialog->reset();
myAudioDialog->reset();
myEventMappingDialog->reset();
myGameInfoDialog->reset();
myHelpDialog->reset();
myAboutDialog->reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OptionsDialog::handleCommand(CommandSender* sender, int cmd, int data)
{

View File

@ -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: OptionsDialog.hxx,v 1.7 2005-05-16 00:02:32 stephena Exp $
// $Id: OptionsDialog.hxx,v 1.8 2005-05-16 15:37:30 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -44,6 +44,7 @@ class OptionsDialog : public Dialog
virtual void handleCommand(CommandSender* sender, int cmd, int data);
void reset();
void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); }
protected: