mirror of
https://github.com/libretro/pcsx2.git
synced 2025-02-14 22:49:50 +00:00
pcsx2|common: use DESTRUCTOR_CATCHALL to catch exception in various destructor
Allow to print a nice error message instead of a brutal abort in case of massive failure
This commit is contained in:
parent
0bb62bb0fd
commit
2eb73644e9
@ -558,7 +558,10 @@ ConsoleIndentScope::ConsoleIndentScope( int tabs )
|
||||
|
||||
ConsoleIndentScope::~ConsoleIndentScope() throw()
|
||||
{
|
||||
LeaveScope();
|
||||
try {
|
||||
LeaveScope();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void ConsoleIndentScope::EnterScope()
|
||||
@ -581,8 +584,11 @@ ConsoleAttrScope::ConsoleAttrScope( ConsoleColors newcolor, int indent )
|
||||
|
||||
ConsoleAttrScope::~ConsoleAttrScope() throw()
|
||||
{
|
||||
Console.SetColor( m_old_color );
|
||||
Console.SetIndent( -m_tabsize );
|
||||
try {
|
||||
Console.SetColor( m_old_color );
|
||||
Console.SetIndent( -m_tabsize );
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,10 +261,13 @@ FastFormatUnicode::FastFormatUnicode()
|
||||
|
||||
FastFormatUnicode::~FastFormatUnicode() throw()
|
||||
{
|
||||
if (m_deleteDest)
|
||||
delete m_dest;
|
||||
else
|
||||
m_buffer_tls.Get()->ReleaseBuffer();
|
||||
try {
|
||||
if (m_deleteDest)
|
||||
delete m_dest;
|
||||
else
|
||||
m_buffer_tls.Get()->ReleaseBuffer();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void FastFormatUnicode::Clear()
|
||||
@ -396,10 +399,13 @@ FastFormatAscii::FastFormatAscii()
|
||||
|
||||
FastFormatAscii::~FastFormatAscii() throw()
|
||||
{
|
||||
if (m_deleteDest)
|
||||
delete m_dest;
|
||||
else
|
||||
m_buffer_tls.Get()->ReleaseBuffer();
|
||||
try {
|
||||
if (m_deleteDest)
|
||||
delete m_dest;
|
||||
else
|
||||
m_buffer_tls.Get()->ReleaseBuffer();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void FastFormatAscii::Clear()
|
||||
|
@ -90,7 +90,10 @@ void SysMtgsThread::OnStart()
|
||||
|
||||
SysMtgsThread::~SysMtgsThread() throw()
|
||||
{
|
||||
_parent::Cancel();
|
||||
try {
|
||||
_parent::Cancel();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void SysMtgsThread::OnResumeReady()
|
||||
|
@ -64,7 +64,10 @@ VU_Thread::VU_Thread(BaseVUmicroCPU*& _vuCPU, VURegs& _vuRegs) :
|
||||
|
||||
VU_Thread::~VU_Thread() throw()
|
||||
{
|
||||
pxThread::Cancel();
|
||||
try {
|
||||
pxThread::Cancel();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void VU_Thread::Reset()
|
||||
|
@ -322,8 +322,11 @@ CpuInitializer< CpuType >::CpuInitializer()
|
||||
template< typename CpuType >
|
||||
CpuInitializer< CpuType >::~CpuInitializer() throw()
|
||||
{
|
||||
if (MyCpu)
|
||||
MyCpu->Shutdown();
|
||||
try {
|
||||
if (MyCpu)
|
||||
MyCpu->Shutdown();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
@ -366,7 +369,10 @@ SysMainMemory::SysMainMemory()
|
||||
|
||||
SysMainMemory::~SysMainMemory() throw()
|
||||
{
|
||||
ReleaseAll();
|
||||
try {
|
||||
ReleaseAll();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void SysMainMemory::ReserveAll()
|
||||
|
@ -55,7 +55,10 @@ SysCoreThread::SysCoreThread()
|
||||
|
||||
SysCoreThread::~SysCoreThread() throw()
|
||||
{
|
||||
SysCoreThread::Cancel();
|
||||
try {
|
||||
SysCoreThread::Cancel();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void SysCoreThread::Cancel( bool isBlocking )
|
||||
|
@ -66,8 +66,11 @@ public:
|
||||
|
||||
virtual ~BaseCpuProvider() throw()
|
||||
{
|
||||
if( m_Reserved != 0 )
|
||||
Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved );
|
||||
try {
|
||||
if( m_Reserved != 0 )
|
||||
Console.Warning( "Cleanup miscount detected on CPU provider. Count=%d", m_Reserved );
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
virtual const char* GetShortName() const=0;
|
||||
|
@ -24,12 +24,15 @@
|
||||
|
||||
BaseCompressThread::~BaseCompressThread() throw()
|
||||
{
|
||||
_parent::Cancel();
|
||||
if( m_PendingSaveFlag )
|
||||
{
|
||||
wxGetApp().ClearPendingSave();
|
||||
m_PendingSaveFlag = false;
|
||||
try {
|
||||
_parent::Cancel();
|
||||
if( m_PendingSaveFlag )
|
||||
{
|
||||
wxGetApp().ClearPendingSave();
|
||||
m_PendingSaveFlag = false;
|
||||
}
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void BaseCompressThread::SetPendingSave()
|
||||
|
@ -89,7 +89,10 @@ AppCoreThread::AppCoreThread() : SysCoreThread()
|
||||
|
||||
AppCoreThread::~AppCoreThread() throw()
|
||||
{
|
||||
_parent::Cancel(); // use parent's, skips thread affinity check.
|
||||
try {
|
||||
_parent::Cancel(); // use parent's, skips thread affinity check.
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
static void _Cancel()
|
||||
@ -734,8 +737,11 @@ ScopedCoreThreadClose::ScopedCoreThreadClose()
|
||||
ScopedCoreThreadClose::~ScopedCoreThreadClose() throw()
|
||||
{
|
||||
if( m_alreadyScoped ) return;
|
||||
_parent::DoResume();
|
||||
ScopedCore_IsFullyClosed = false;
|
||||
try {
|
||||
_parent::DoResume();
|
||||
ScopedCore_IsFullyClosed = false;
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse_me )
|
||||
@ -761,8 +767,11 @@ ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse
|
||||
ScopedCoreThreadPause::~ScopedCoreThreadPause() throw()
|
||||
{
|
||||
if( m_alreadyScoped ) return;
|
||||
_parent::DoResume();
|
||||
ScopedCore_IsPaused = false;
|
||||
try {
|
||||
_parent::DoResume();
|
||||
ScopedCore_IsPaused = false;
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
ScopedCoreThreadPopup::ScopedCoreThreadPopup()
|
||||
|
@ -48,7 +48,10 @@ protected:
|
||||
public:
|
||||
AppGameDatabase() {}
|
||||
virtual ~AppGameDatabase() throw() {
|
||||
Console.WriteLn( "(GameDB) Unloading..." );
|
||||
try {
|
||||
Console.WriteLn( "(GameDB) Unloading..." );
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
AppGameDatabase& LoadFromFile(const wxString& file = Path::Combine( PathDefs::GetProgramDataDir(), wxFileName(L"GameIndex.dbf") ), const wxString& key = L"Serial" );
|
||||
|
@ -374,7 +374,10 @@ public:
|
||||
|
||||
virtual ~GameDatabaseLoaderThread() throw()
|
||||
{
|
||||
_parent::Cancel();
|
||||
try {
|
||||
_parent::Cancel();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -163,7 +163,10 @@ ConsoleLogFrame::ColorArray::ColorArray( int fontsize )
|
||||
|
||||
ConsoleLogFrame::ColorArray::~ColorArray() throw()
|
||||
{
|
||||
Cleanup();
|
||||
try {
|
||||
Cleanup();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::ColorArray::Create( int fontsize )
|
||||
|
@ -544,12 +544,15 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
|
||||
|
||||
MainEmuFrame::~MainEmuFrame() throw()
|
||||
{
|
||||
if( m_RestartEmuOnDelete )
|
||||
{
|
||||
sApp.SetExitOnFrameDelete( false );
|
||||
sApp.PostAppMethod( &Pcsx2App::DetectCpuAndUserMode );
|
||||
sApp.WipeUserModeSettings();
|
||||
try {
|
||||
if( m_RestartEmuOnDelete )
|
||||
{
|
||||
sApp.SetExitOnFrameDelete( false );
|
||||
sApp.PostAppMethod( &Pcsx2App::DetectCpuAndUserMode );
|
||||
sApp.WipeUserModeSettings();
|
||||
}
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
void MainEmuFrame::DoGiveHelp(const wxString& text, bool show)
|
||||
|
@ -561,7 +561,10 @@ namespace Panels
|
||||
public:
|
||||
virtual ~EnumThread() throw()
|
||||
{
|
||||
pxThread::Cancel();
|
||||
try {
|
||||
pxThread::Cancel();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL
|
||||
}
|
||||
|
||||
EnumThread( PluginSelectorPanel& master );
|
||||
|
Loading…
x
Reference in New Issue
Block a user