* Likely fix for linux's crash-on-exit.

* Fix for random crash when hot-swapping plugins from the config panel.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2987 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-05-12 13:58:10 +00:00
parent 052506785b
commit 23a7f7ad21
8 changed files with 25 additions and 17 deletions

View File

@ -576,8 +576,8 @@ protected:
void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event);
void OnEmuKeyDown( wxKeyEvent& evt );
void OnSysExecutorTaskTimeout( wxTimerEvent& evt );
void OnDestroyWindow( wxWindowDestroyEvent& evt );
// ----------------------------------------------------------------------------
// Override wx default exception handling behavior

View File

@ -426,6 +426,8 @@ bool Pcsx2App::OnInit()
Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler (Pcsx2App::OnEmuKeyDown) );
Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (Pcsx2App::OnDestroyWindow) );
// User/Admin Mode Dual Setup:
// PCSX2 now supports two fundamental modes of operation. The default is Classic mode,
// which uses the Current Working Directory (CWD) for all user data files, and requires
@ -554,6 +556,24 @@ int Pcsx2App::OnExit()
return wxApp::OnExit();
}
void Pcsx2App::OnDestroyWindow( wxWindowDestroyEvent& evt )
{
// Precautions:
// * Whenever windows are destroyed, make sure to check if it matches our "active"
// console logger. If so, we need to disable logging to the console window, or else
// it'll crash. (this is because the console log system uses a cached window handle
// instead of looking the window up via it's ID -- fast but potentially unsafe).
//
// * The virtual machine's plugins usually depend on the GS window handle being valid,
// so if the GS window is the one being shut down then we need to make sure to close
// out the Corethread before it vanishes completely from existence.
OnProgramLogClosed( evt.GetId() );
OnGsFrameClosed( evt.GetId() );
evt.Skip();
}
// --------------------------------------------------------------------------------------
// SysEventHandler
// --------------------------------------------------------------------------------------

View File

@ -816,8 +816,10 @@ void Pcsx2App::CloseGsPanel()
}
}
void Pcsx2App::OnGsFrameClosed()
void Pcsx2App::OnGsFrameClosed( wxWindowID id )
{
if( (m_id_GsFrame == wxID_ANY) || (m_id_GsFrame != id) ) return;
CoreThread.Suspend();
m_id_GsFrame = wxID_ANY;
}

View File

@ -313,7 +313,6 @@ ConsoleLogFrame::ConsoleLogFrame( MainEmuFrame *parent, const wxString& title, A
Connect( m_item_StdoutIOP->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( ConsoleLogFrame::OnLogSourceChanged ) );
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (ConsoleLogFrame::OnCloseWindow) );
Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (ConsoleLogFrame::OnDestroyWindow) );
Connect( wxEVT_MOVE, wxMoveEventHandler (ConsoleLogFrame::OnMoveAround) );
Connect( wxEVT_SIZE, wxSizeEventHandler (ConsoleLogFrame::OnResize) );
Connect( wxEVT_ACTIVATE, wxActivateEventHandler (ConsoleLogFrame::OnActivate) );
@ -514,12 +513,6 @@ void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& event)
}
}
void ConsoleLogFrame::OnDestroyWindow(wxWindowDestroyEvent& event)
{
m_threadlogger = NULL;
wxGetApp().OnProgramLogClosed( GetId() );
}
void ConsoleLogFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{
Show(true);

View File

@ -250,7 +250,6 @@ protected:
void OnLogSourceChanged(wxCommandEvent& event);
virtual void OnCloseWindow(wxCloseEvent& event);
virtual void OnDestroyWindow(wxWindowDestroyEvent& event);
void OnSetTitle( wxCommandEvent& event );
void OnDockedMove( wxCommandEvent& event );

View File

@ -105,11 +105,6 @@ void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
evt.Skip();
}
void MainEmuFrame::OnDestroyWindow( wxWindowDestroyEvent& evt )
{
evt.Skip();
}
void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
{
// Uncomment this when doing logger stress testing (and then move the window around
@ -468,7 +463,6 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
ConnectMenus();
Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) );
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (MainEmuFrame::OnCloseWindow) );
Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (MainEmuFrame::OnDestroyWindow) );
Connect( wxEVT_SET_FOCUS, wxFocusEventHandler (MainEmuFrame::OnFocus) );

View File

@ -157,7 +157,6 @@ protected:
void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf );
void OnCloseWindow( wxCloseEvent& evt );
void OnDestroyWindow( wxWindowDestroyEvent& evt );
void OnMoveAround( wxMoveEvent& evt );
void OnFocus( wxFocusEvent& evt );
void OnActivate( wxActivateEvent& evt );

View File

@ -271,6 +271,7 @@ void SysExecEvent_ApplyPlugins::InvokeEvent()
CorePlugins.Shutdown();
CorePlugins.Unload();
LoadPluginsImmediate();
CorePlugins.Init();
if( buffer ) CoreThread.UploadStateCopy( *buffer );