Don't timeout on a Wait() if a dialog is showing. The movie decode semaphone would timeout on most dialogs.
Increase Win32 semaphone timeout from 15 -> 60 secs.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
static DialogDriver *g_pImpl = NULL;
|
static DialogDriver *g_pImpl = NULL;
|
||||||
static DialogDriverNull g_pNullDriver;
|
static DialogDriverNull g_pNullDriver;
|
||||||
static bool g_bWindowed = false;
|
static bool g_bWindowed = false;
|
||||||
|
static bool g_bIsShowingDialog = false;
|
||||||
|
|
||||||
void Dialog::Init()
|
void Dialog::Init()
|
||||||
{
|
{
|
||||||
@@ -59,6 +60,11 @@ void Dialog::Shutdown()
|
|||||||
g_pImpl = NULL;
|
g_pImpl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Dialog::IsShowingDialog()
|
||||||
|
{
|
||||||
|
return g_bIsShowingDialog;
|
||||||
|
}
|
||||||
|
|
||||||
static bool MessageIsIgnored( CString ID )
|
static bool MessageIsIgnored( CString ID )
|
||||||
{
|
{
|
||||||
vector<CString> list;
|
vector<CString> list;
|
||||||
@@ -100,7 +106,11 @@ void Dialog::Error( CString sMessage, CString ID )
|
|||||||
if( ID != "" && MessageIsIgnored( ID ) )
|
if( ID != "" && MessageIsIgnored( ID ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_bIsShowingDialog = true;
|
||||||
|
|
||||||
g_pImpl->Error( sMessage, ID );
|
g_pImpl->Error( sMessage, ID );
|
||||||
|
|
||||||
|
g_bIsShowingDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::SetWindowed( bool bWindowed )
|
void Dialog::SetWindowed( bool bWindowed )
|
||||||
@@ -115,11 +125,15 @@ void Dialog::OK( CString sMessage, CString ID )
|
|||||||
if( ID != "" && MessageIsIgnored( ID ) )
|
if( ID != "" && MessageIsIgnored( ID ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_bIsShowingDialog = true;
|
||||||
|
|
||||||
// only show Dialog if windowed
|
// only show Dialog if windowed
|
||||||
if( !g_bWindowed )
|
if( !g_bWindowed )
|
||||||
g_pNullDriver.OK( sMessage, ID );
|
g_pNullDriver.OK( sMessage, ID );
|
||||||
else
|
else
|
||||||
g_pImpl->OK( sMessage, ID ); // call derived version
|
g_pImpl->OK( sMessage, ID ); // call derived version
|
||||||
|
|
||||||
|
g_bIsShowingDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
|
Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
|
||||||
@@ -129,11 +143,15 @@ Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
|
|||||||
if( ID != "" && MessageIsIgnored( ID ) )
|
if( ID != "" && MessageIsIgnored( ID ) )
|
||||||
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
|
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
|
||||||
|
|
||||||
|
g_bIsShowingDialog = true;
|
||||||
|
|
||||||
// only show Dialog if windowed
|
// only show Dialog if windowed
|
||||||
if( !g_bWindowed )
|
if( !g_bWindowed )
|
||||||
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
|
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
|
||||||
else
|
else
|
||||||
return g_pImpl->AbortRetryIgnore( sMessage, ID ); // call derived version
|
return g_pImpl->AbortRetryIgnore( sMessage, ID ); // call derived version
|
||||||
|
|
||||||
|
g_bIsShowingDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
|
Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
|
||||||
@@ -143,11 +161,15 @@ Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
|
|||||||
if( ID != "" && MessageIsIgnored( ID ) )
|
if( ID != "" && MessageIsIgnored( ID ) )
|
||||||
return g_pNullDriver.RetryCancel( sMessage, ID );
|
return g_pNullDriver.RetryCancel( sMessage, ID );
|
||||||
|
|
||||||
|
g_bIsShowingDialog = true;
|
||||||
|
|
||||||
// only show Dialog if windowed
|
// only show Dialog if windowed
|
||||||
if( !g_bWindowed )
|
if( !g_bWindowed )
|
||||||
return g_pNullDriver.RetryCancel( sMessage, ID );
|
return g_pNullDriver.RetryCancel( sMessage, ID );
|
||||||
else
|
else
|
||||||
return g_pImpl->RetryCancel( sMessage, ID ); // call derived version
|
return g_pImpl->RetryCancel( sMessage, ID ); // call derived version
|
||||||
|
|
||||||
|
g_bIsShowingDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace Dialog
|
|||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
void SetWindowed( bool bWindowed );
|
void SetWindowed( bool bWindowed );
|
||||||
|
bool IsShowingDialog();
|
||||||
|
|
||||||
enum Result { abort, retry, ignore, cancel };
|
enum Result { abort, retry, ignore, cancel };
|
||||||
void Error( CString error, CString ID = "" );
|
void Error( CString error, CString ID = "" );
|
||||||
|
|||||||
@@ -188,12 +188,14 @@ void SemaImpl_Win32::Post()
|
|||||||
|
|
||||||
bool SemaImpl_Win32::Wait()
|
bool SemaImpl_Win32::Wait()
|
||||||
{
|
{
|
||||||
int len = 15000;
|
int len = 60000;
|
||||||
int tries = 2;
|
int tries = 2;
|
||||||
|
|
||||||
while( tries-- )
|
while( tries-- )
|
||||||
{
|
{
|
||||||
/* Wait for fifteen seconds. If it takes longer than that, we're probably deadlocked. */
|
/* Wait for 60 seconds. In debug builds, some screens may take longer
|
||||||
|
* than 15 seconds to load. If it takes longer than that, we're
|
||||||
|
* probably deadlocked. */
|
||||||
if( SimpleWaitForSingleObject( sem, len ) )
|
if( SimpleWaitForSingleObject( sem, len ) )
|
||||||
{
|
{
|
||||||
--m_iCounter;
|
--m_iCounter;
|
||||||
|
|||||||
Reference in New Issue
Block a user