UI: Saw some other minor mistakes in the console log threading >_<

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3426 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-07-08 15:55:02 +00:00
parent 972cb2b891
commit 8c66bd87ba
2 changed files with 10 additions and 5 deletions

View File

@ -904,6 +904,8 @@ void Pcsx2App::OnGsFrameClosed( wxWindowID id )
void Pcsx2App::OnProgramLogClosed( wxWindowID id )
{
if( (m_id_ProgramLogBox == wxID_ANY) || (m_id_ProgramLogBox != id) ) return;
ScopedLock lock( m_mtx_ProgramLog );
m_id_ProgramLogBox = wxID_ANY;
DisableWindowLogging();
}

View File

@ -228,6 +228,8 @@ enum MenuIDs_t
MenuID_FontSize_Huge,
};
#define pxTheApp ((Pcsx2App&)*wxTheApp)
// --------------------------------------------------------------------------------------
// ScopedLogLock (implementations)
// --------------------------------------------------------------------------------------
@ -238,9 +240,9 @@ public:
public:
ScopedLogLock()
: ScopedLock( ((Pcsx2App&)*wxTheApp).GetProgramLogLock() )
: ScopedLock( wxThread::IsMain() ? NULL : &pxTheApp.GetProgramLogLock() )
{
WindowPtr = ((Pcsx2App&)*wxTheApp).m_ptr_ProgramLog;
WindowPtr = pxTheApp.m_ptr_ProgramLog;
}
virtual ~ScopedLogLock() throw() {}
@ -903,7 +905,7 @@ static const IConsoleWriter ConsoleWriter_WindowAndFile =
void Pcsx2App::EnableAllLogging()
{
ScopedLock lock( m_mtx_ProgramLog );
AffinityAssert_AllowFrom_MainUI();
const bool logBoxOpen = (m_ptr_ProgramLog != NULL);
const IConsoleWriter* newHandler = NULL;
@ -932,6 +934,8 @@ void Pcsx2App::EnableAllLogging()
// emuLog file handle. Call SetConsoleLogging to re-enable the disk logger when finished.
void Pcsx2App::DisableDiskLogging() const
{
AffinityAssert_AllowFrom_MainUI();
const bool logBoxOpen = (GetProgramLog() != NULL);
Console_SetActiveHandler( logBoxOpen ? (IConsoleWriter&)ConsoleWriter_Window : (IConsoleWriter&)ConsoleWriter_Stdout );
@ -950,7 +954,6 @@ void Pcsx2App::DisableDiskLogging() const
void Pcsx2App::DisableWindowLogging() const
{
ScopedLock lock( m_mtx_ProgramLog );
AffinityAssert_AllowFrom_MainUI();
Console_SetActiveHandler( (emuLog!=NULL) ? (IConsoleWriter&)ConsoleWriter_File : (IConsoleWriter&)ConsoleWriter_Stdout );
//Threading::Sleep( 5 );
}