summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/workben/canvasdemo.cxx9
-rw-r--r--desktop/inc/app.hxx2
-rw-r--r--desktop/source/app/app.cxx8
-rw-r--r--include/vcl/exceptiontypes.hxx8
-rw-r--r--include/vcl/svapp.hxx11
-rw-r--r--slideshow/test/demoshow.cxx9
-rw-r--r--vcl/source/app/svapp.cxx10
-rw-r--r--vcl/source/app/svmain.cxx74
-rw-r--r--vcl/workben/outdevgrind.cxx9
9 files changed, 65 insertions, 75 deletions
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index 4a8143c23a87..af2319ab514b 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -64,7 +64,7 @@ class DemoApp : public Application
{
public:
virtual void Main();
- virtual USHORT Exception( USHORT nError );
+ virtual void Exception( ExceptionCategory nCategory );
};
static void PrintHelp()
@@ -621,15 +621,14 @@ void TestWindow::Paint( const Rectangle& /*rRect*/ )
}
}
-USHORT DemoApp::Exception( USHORT nError )
+void DemoApp::Exception( ExceptionCategory nCategory )
{
- switch( nError & EXCEPTION_MAJORTYPE )
+ switch( nCategory )
{
- case EXCEPTION_RESOURCENOTLOADED:
+ case ExceptionCategory::ResourceNotLoaded:
Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
break;
}
- return 0;
}
void DemoApp::Main()
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 3bcc098a81c7..1905cf0c1d7c 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -76,7 +76,7 @@ class Desktop : public Application
virtual void InitFinished() override;
virtual void DeInit() override;
virtual bool QueryExit() override;
- virtual void Exception(sal_uInt16 nError) override;
+ virtual void Exception(ExceptionCategory nCategory) override;
virtual void OverrideSystemSettings( AllSettings& rSettings ) override;
virtual void AppEvent( const ApplicationEvent& rAppEvent ) override;
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 133c4c5bef17..847381c23287 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1223,7 +1223,7 @@ void restartOnMac(bool passArguments) {
}
-void Desktop::Exception(sal_uInt16 nError)
+void Desktop::Exception(ExceptionCategory nCategory)
{
// protect against recursive calls
static bool bInException = false;
@@ -1244,7 +1244,7 @@ void Desktop::Exception(sal_uInt16 nError)
bool bAllowRecoveryAndSessionManagement = (
( !rArgs.IsNoRestore() ) && // some use cases of office must work without recovery
( !rArgs.IsHeadless() ) &&
- (( nError & EXCEPTION_MAJORTYPE ) != EXCEPTION_DISPLAY ) && // recovery can't work without UI ... but UI layer seems to be the reason for this crash
+ ( nCategory != ExceptionCategory::UserInterface ) && // recovery can't work without UI ... but UI layer seems to be the reason for this crash
( Application::IsInExecute() ) // crashes during startup and shutdown should be ignored (they indicates a corrupt installation ...)
);
if ( bAllowRecoveryAndSessionManagement )
@@ -1252,9 +1252,9 @@ void Desktop::Exception(sal_uInt16 nError)
FlushConfiguration();
- switch( nError & EXCEPTION_MAJORTYPE )
+ switch( nCategory )
{
- case EXCEPTION_RESOURCENOTLOADED:
+ case ExceptionCategory::ResourceNotLoaded:
{
OUString aResExceptionString;
Application::Abort( aResExceptionString );
diff --git a/include/vcl/exceptiontypes.hxx b/include/vcl/exceptiontypes.hxx
index bdf044a47edd..bde3f5f5f91d 100644
--- a/include/vcl/exceptiontypes.hxx
+++ b/include/vcl/exceptiontypes.hxx
@@ -20,11 +20,9 @@
#ifndef INCLUDED_VCL_EXCEPTIONTYPES_HXX
#define INCLUDED_VCL_EXCEPTIONTYPES_HXX
-#define EXCEPTION_RESOURCENOTLOADED ((sal_uInt16)0x0100)
-#define EXCEPTION_SYSTEM ((sal_uInt16)0x0300)
-#define EXCEPTION_DISPLAY ((sal_uInt16)0x0400)
-#define EXCEPTION_MAJORTYPE ((sal_uInt16)0xFF00)
-#define EXCEPTION_MINORTYPE ((sal_uInt16)0x00FF)
+enum class ExceptionCategory {
+ NONE, ResourceNotLoaded, System, UserInterface
+};
#endif // INCLUDED_VCL_EXCEPTIONTYPES_HXX
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 639433b01fb2..7d190b9f83fa 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -421,18 +421,13 @@ public:
@{
*/
- /** Handles an error code.
+ /** Handles an error.
- @remark This is not actually an exception. It merely takes an
- error code, then in most cases aborts. The list of exception
- identifiers can be found at include/vcl/inputtypes.hxx - each
- one starts with EXC_*
-
- @param nError The error code identifier
+ @param nCategory The error category, see include/vcl/exceptiontypes.hxx
@see Abort
*/
- virtual void Exception( sal_uInt16 nError );
+ virtual void Exception( ExceptionCategory nCategory );
/** Ends the program prematurely with an error message.
diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx
index 17560f8bc5ea..1183c7d3e27e 100644
--- a/slideshow/test/demoshow.cxx
+++ b/slideshow/test/demoshow.cxx
@@ -301,7 +301,7 @@ class DemoApp : public Application
{
public:
virtual void Main();
- virtual sal_uInt16 Exception( sal_uInt16 nError );
+ virtual void Exception( ExceptionCategory nCategory );
};
class ChildWindow : public vcl::Window
@@ -481,15 +481,14 @@ void DemoWindow::Resize()
// TODO
}
-sal_uInt16 DemoApp::Exception( sal_uInt16 nError )
+void DemoApp::Exception( ExceptionCategory nCategory )
{
- switch( nError & EXCEPTION_MAJORTYPE )
+ switch( nCategory )
{
- case EXCEPTION_RESOURCENOTLOADED:
+ case ExceptionCategory::ResourceNotLoaded:
Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
break;
}
- return 0;
}
void DemoApp::Main()
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 1374a7a6d9bf..be670e0a9160 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -279,17 +279,17 @@ OUString Application::GetAppFileName()
return aAppFileName;
}
-void Application::Exception( sal_uInt16 nError )
+void Application::Exception( ExceptionCategory nCategory )
{
- switch ( nError & EXCEPTION_MAJORTYPE )
+ switch ( nCategory )
{
// System has precedence (so do nothing)
- case EXCEPTION_SYSTEM:
- case EXCEPTION_DISPLAY:
+ case ExceptionCategory::System:
+ case ExceptionCategory::UserInterface:
break;
#ifdef DBG_UTIL
- case EXCEPTION_RESOURCENOTLOADED:
+ case ExceptionCategory::ResourceNotLoaded:
Abort("Resource not loaded");
break;
default:
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 39e62315c24b..2b315b2606d0 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -102,52 +102,50 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo
static volatile bool bIn = false;
// if we crash again, bail out immediately
- if ( !bIn )
- {
- sal_uInt16 nVCLException = 0;
+ if ( bIn )
+ return osl_Signal_ActCallNextHdl;
- // UAE
- if ( (pInfo->Signal == osl_Signal_AccessViolation) ||
- (pInfo->Signal == osl_Signal_IntegerDivideByZero) ||
- (pInfo->Signal == osl_Signal_FloatDivideByZero) ||
- (pInfo->Signal == osl_Signal_DebugBreak) )
- {
- nVCLException = EXCEPTION_SYSTEM;
+ ExceptionCategory nVCLException = ExceptionCategory::NONE;
+
+ // UAE
+ if ( (pInfo->Signal == osl_Signal_AccessViolation) ||
+ (pInfo->Signal == osl_Signal_IntegerDivideByZero) ||
+ (pInfo->Signal == osl_Signal_FloatDivideByZero) ||
+ (pInfo->Signal == osl_Signal_DebugBreak) )
+ {
+ nVCLException = ExceptionCategory::System;
#if HAVE_FEATURE_OPENGL
- if (OpenGLZone::isInZone())
- OpenGLZone::hardDisable();
+ if (OpenGLZone::isInZone())
+ OpenGLZone::hardDisable();
#endif
- }
+ }
+
+ // RC
+ if ((pInfo->Signal == osl_Signal_User) &&
+ (pInfo->UserSignal == OSL_SIGNAL_USER_RESOURCEFAILURE) )
+ nVCLException = ExceptionCategory::ResourceNotLoaded;
- // RC
- if ((pInfo->Signal == osl_Signal_User) &&
- (pInfo->UserSignal == OSL_SIGNAL_USER_RESOURCEFAILURE) )
- nVCLException = EXCEPTION_RESOURCENOTLOADED;
+ // DISPLAY-Unix
+ if ((pInfo->Signal == osl_Signal_User) &&
+ (pInfo->UserSignal == OSL_SIGNAL_USER_X11SUBSYSTEMERROR) )
+ nVCLException = ExceptionCategory::UserInterface;
+
+ if ( nVCLException != ExceptionCategory::NONE )
+ {
+ bIn = true;
- // DISPLAY-Unix
- if ((pInfo->Signal == osl_Signal_User) &&
- (pInfo->UserSignal == OSL_SIGNAL_USER_X11SUBSYSTEMERROR) )
- nVCLException = EXCEPTION_DISPLAY;
+ SolarMutexGuard aLock;
- if ( nVCLException )
+ // do not stop timer because otherwise the UAE-Box will not be painted as well
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->mpApp )
{
- bIn = true;
-
- SolarMutexGuard aLock;
-
- // do not stop timer because otherwise the UAE-Box will not be painted as well
- ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->mpApp )
- {
- SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
- Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
- pSVData->mpApp->Exception( nVCLException );
- Application::SetSystemWindowMode( nOldMode );
- }
- bIn = false;
-
- return osl_Signal_ActCallNextHdl;
+ SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
+ pSVData->mpApp->Exception( nVCLException );
+ Application::SetSystemWindowMode( nOldMode );
}
+ bIn = false;
}
return osl_Signal_ActCallNextHdl;
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index 11b312533705..e6ff4f48cbff 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -57,7 +57,7 @@ class GrindApp : public Application
{
public:
virtual int Main() override;
- virtual void Exception( sal_uInt16 nError ) override;
+ virtual void Exception( ExceptionCategory nCategory ) override;
};
class TestWindow : public Dialog
@@ -669,13 +669,14 @@ void TestWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
fflush(stdout);
}
-void GrindApp::Exception( sal_uInt16 nError )
+void GrindApp::Exception( ExceptionCategory nCategory )
{
- switch( nError & EXCEPTION_MAJORTYPE )
+ switch( nCategory )
{
- case EXCEPTION_RESOURCENOTLOADED:
+ case ExceptionCategory::ResourceNotLoaded:
Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
break;
+ default: break;
}
}