From 4cf2f745d119d86164f22f337327ddcf5a7a3f7a Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Tue, 12 Sep 2006 13:05:07 +0000 Subject: [PATCH] - some fixes to avoid segfaults after early panics - fixed gameport log type - wx: store mouse capture mode in the gui code (only access the mouse parameter when the capture mode changes) - wx: don't initialize wxScreen if already done and clear screen on exit --- bochs/bochs.h | 4 ++-- bochs/gui/wx.cc | 20 +++++++++++--------- bochs/iodev/gameport.cc | 5 +++-- bochs/iodev/keyboard.cc | 5 +++-- bochs/iodev/serial.cc | 3 ++- bochs/plugin.cc | 6 +++--- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/bochs/bochs.h b/bochs/bochs.h index be55f5cb9..c45c1cf3a 100644 --- a/bochs/bochs.h +++ b/bochs/bochs.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: bochs.h,v 1.196 2006-09-09 11:28:52 vruppert Exp $ +// $Id: bochs.h,v 1.197 2006-09-12 13:05:07 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -294,7 +294,7 @@ enum { CPU10LOG, CPU11LOG, CPU12LOG, CPU13LOG, CPU14LOG, CPU15LOG, CTRLLOG, UNMAPLOG, SERRLOG, BIOSLOG, PIT81LOG, PIT82LOG, IODEBUGLOG, PCI2ISALOG, PLUGINLOG, EXTFPUIRQLOG , PCIVGALOG, PCIUSBLOG, VTIMERLOG, STIMERLOG, - PCIIDELOG, PCIDEVLOG, PCIPNICLOG, SPEAKERLOG, BUSMLOG + PCIIDELOG, PCIDEVLOG, PCIPNICLOG, SPEAKERLOG, BUSMLOG, GAMELOG }; class BOCHSAPI iofunctions { diff --git a/bochs/gui/wx.cc b/bochs/gui/wx.cc index 5daae594b..d21dcdd8c 100644 --- a/bochs/gui/wx.cc +++ b/bochs/gui/wx.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wx.cc,v 1.86 2006-09-03 05:52:52 vruppert Exp $ +// $Id: wx.cc,v 1.87 2006-09-12 13:05:07 vruppert Exp $ ///////////////////////////////////////////////////////////////// // // wxWidgets VGA display for Bochs. wx.cc implements a custom @@ -112,6 +112,7 @@ static struct { wxCriticalSection event_thread_lock; BxEvent event_queue[MAX_EVENTS]; unsigned long num_events = 0; +static bx_bool mouse_captured = 0; #if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__) static Bit32u convertStringToGDKKey (const char *string); #endif @@ -233,7 +234,7 @@ void MyPanel::OnMouse(wxMouseEvent& event) return; } - if (!SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get()) + if (!mouse_captured) return; // mouse disabled, ignore the event // process buttons and motion together @@ -902,8 +903,10 @@ bx_wx_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned t IFDBG_VGA(wxLogDebug (wxT ("MyPanel::specific_init trying to get lock. wxScreen=%p", wxScreen))); wxCriticalSectionLocker lock(wxScreen_lock); IFDBG_VGA(wxLogDebug (wxT ("MyPanel::specific_init got lock. wxScreen=%p", wxScreen))); - wxScreen = (char *)malloc(wxScreenX * wxScreenY * 3); - memset(wxScreen, 0, wxScreenX * wxScreenY * 3); + if (wxScreen == NULL) { + wxScreen = (char *)malloc(wxScreenX * wxScreenY * 3); + memset(wxScreen, 0, wxScreenX * wxScreenY * 3); + } wxTileX = tilewidth; wxTileY = tileheight; @@ -1581,15 +1584,14 @@ bx_wx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id) // Called before bochs terminates, to allow for a graceful // exit from the native GUI mechanism. - void -bx_wx_gui_c::exit(void) +void bx_wx_gui_c::exit(void) { - BX_INFO(("bx_wx_gui_c::exit() not implemented yet.")); + clear_screen(); } - void -bx_wx_gui_c::mouse_enabled_changed_specific (bx_bool val) +void bx_wx_gui_c::mouse_enabled_changed_specific(bx_bool val) { + mouse_captured = val; } diff --git a/bochs/iodev/gameport.cc b/bochs/iodev/gameport.cc index c6f5c4f7d..11f46c257 100644 --- a/bochs/iodev/gameport.cc +++ b/bochs/iodev/gameport.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: gameport.cc,v 1.11 2006-09-10 17:18:44 vruppert Exp $ +// $Id: gameport.cc,v 1.12 2006-09-12 13:05:07 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2003 MandrakeSoft S.A. @@ -75,7 +75,8 @@ void libgameport_LTX_plugin_fini(void) bx_gameport_c::bx_gameport_c() { put("GAME"); - settype(EXTFPUIRQLOG); + settype(GAMELOG); + joyfd = -1; } bx_gameport_c::~bx_gameport_c() diff --git a/bochs/iodev/keyboard.cc b/bochs/iodev/keyboard.cc index f11654d37..80213e42c 100644 --- a/bochs/iodev/keyboard.cc +++ b/bochs/iodev/keyboard.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: keyboard.cc,v 1.123 2006-09-10 17:18:44 vruppert Exp $ +// $Id: keyboard.cc,v 1.124 2006-09-12 13:05:07 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -84,6 +84,7 @@ bx_keyb_c::bx_keyb_c() { put("KBD"); settype(KBDLOG); + pastebuf = NULL; } bx_keyb_c::~bx_keyb_c() @@ -114,7 +115,7 @@ void bx_keyb_c::resetinternals(bx_bool powerup) void bx_keyb_c::init(void) { - BX_DEBUG(("Init $Id: keyboard.cc,v 1.123 2006-09-10 17:18:44 vruppert Exp $")); + BX_DEBUG(("Init $Id: keyboard.cc,v 1.124 2006-09-12 13:05:07 vruppert Exp $")); Bit32u i; DEV_register_irq(1, "8042 Keyboard controller"); diff --git a/bochs/iodev/serial.cc b/bochs/iodev/serial.cc index ec8ae1933..0285f0bcc 100644 --- a/bochs/iodev/serial.cc +++ b/bochs/iodev/serial.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: serial.cc,v 1.73 2006-09-10 17:18:44 vruppert Exp $ +// $Id: serial.cc,v 1.74 2006-09-12 13:05:07 vruppert Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2004 MandrakeSoft S.A. @@ -70,6 +70,7 @@ bx_serial_c::bx_serial_c(void) put("SER"); settype(SERLOG); for (int i=0; iplugin != NULL) { #if BX_PLUGINS bx_unload_plugin(device->name); @@ -642,7 +642,7 @@ void bx_unload_plugins() next = device->next; free(device); device = next; - } while (device != NULL); + }; devices = NULL; }