summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-21 21:29:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-06-22 11:33:58 +0100
commit68cf256f506d4601a2d2cf3ec2d56713afd491e6 (patch)
tree4eb2eaa305fbe62fcc175b8982550d1f1014232c /framework
parent8dc2873081bff3fe7107d472a91a24af8b67a87d (diff)
Resolves: tdf#88985 block app from exiting during macro execution
but stop basic execution on the exit attempt, and then resend exit at a safe place when basic execution has stopped Change-Id: I77c43acffa0b82e8125dcb3b10ad9bf0d6dd26c3
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services/desktop.hxx12
-rw-r--r--framework/source/services/desktop.cxx23
2 files changed, 35 insertions, 0 deletions
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index e8fd0017d628..6e0c21551589 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -428,6 +428,18 @@ class Desktop : private cppu::BaseMutex,
*/
css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
+ /** special terminate listener active when a macro is executing.
+ * Because basic runs Application::Yield internally the application may quit
+ * while running inside the internal basic event loop. So all the basic
+ * infrastructure may be deleted while the call is executing, leading to
+ * a varient of crashes. So this special terminate listener will
+ * veto the current quit attempt, stop basic execution, which will
+ * cause the inner event loop to quit, and on return to the outer normal
+ * application event loop then resend the quit attempt.
+ * So these implementation must be a special terminate listener too .-(
+ */
+ css::uno::Reference< css::frame::XTerminateListener > m_xStarBasicQuitGuard;
+
/** special terminate listener which loads images asynchronous for current open documents.
* Because internally it uses blocking system APIs... it can't be guaranteed that
* running jobs can be cancelled successfully if the corresponding document will be closed...
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 64e7e645f3d7..0ec0bce5bf94 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -171,6 +171,7 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon
, m_xDispatchRecorderSupplier( )
, m_xPipeTerminator ( )
, m_xQuickLauncher ( )
+ , m_xStarBasicQuitGuard ( )
, m_xSWThreadManager ( )
, m_xSfxTerminator ( )
, m_xTitleNumberGenerator ( )
@@ -214,6 +215,7 @@ sal_Bool SAL_CALL Desktop::terminate()
css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator;
css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher;
+ css::uno::Reference< css::frame::XTerminateListener > xStarBasicQuitGuard = m_xStarBasicQuitGuard;
css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager;
css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator;
@@ -275,6 +277,12 @@ sal_Bool SAL_CALL Desktop::terminate()
lCalledTerminationListener.push_back( xQuickLauncher );
}
+ if ( xStarBasicQuitGuard.is() )
+ {
+ xStarBasicQuitGuard->queryTermination( aEvent );
+ lCalledTerminationListener.push_back( xStarBasicQuitGuard );
+ }
+
if ( xSWThreadManager.is() )
{
xSWThreadManager->queryTermination( aEvent );
@@ -322,6 +330,9 @@ sal_Bool SAL_CALL Desktop::terminate()
xQuickLauncher->notifyTermination( aEvent );
}
+ if ( xStarBasicQuitGuard.is() )
+ xStarBasicQuitGuard->notifyTermination( aEvent );
+
if ( xSWThreadManager.is() )
xSWThreadManager->notifyTermination( aEvent );
@@ -395,6 +406,11 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra
m_xQuickLauncher = xListener;
return;
}
+ if( sImplementationName == "com.sun.star.comp.svx.StarBasicQuitGuard" )
+ {
+ m_xStarBasicQuitGuard = xListener;
+ return;
+ }
if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
{
m_xSWThreadManager = xListener;
@@ -436,6 +452,12 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::
return;
}
+ if( sImplementationName == "com.sun.star.comp.svx.StarBasicQuitGuard" )
+ {
+ m_xStarBasicQuitGuard.clear();
+ return;
+ }
+
if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
{
m_xSWThreadManager.clear();
@@ -1068,6 +1090,7 @@ void SAL_CALL Desktop::disposing()
m_xPipeTerminator.clear();
m_xQuickLauncher.clear();
+ m_xStarBasicQuitGuard.clear();
m_xSWThreadManager.clear();
m_xSfxTerminator.clear();
m_xCommandOptions.reset();