diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-07-13 13:57:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-07-13 15:47:46 +0200 |
commit | 58aac6e941c0a84e568c14e2aa276c867f725dff (patch) | |
tree | d0e41a269ec8c2305f10830d89f0f8220bfbcd7b | |
parent | 303c46e2394f6b744f0df5e8e55a8e1cd8e22a91 (diff) |
framework, sfx2: catch more exceptions when the object is already disposed
This can happen when an out of process Java object is registered as a
callback, then that Java process exits without notifying us.
Handle this failure by just ignoring that object, so we don't crash on
soffice process shutdown.
Change-Id: I5d61e76494c62148ef0c3db24789a5ea6e5843eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118823
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | framework/source/dispatch/interceptionhelper.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/control/statcach.cxx | 10 |
2 files changed, 25 insertions, 2 deletions
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index 899ce2440946..5287244b677a 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -20,8 +20,12 @@ #include <dispatch/interceptionhelper.hxx> #include <com/sun/star/frame/XInterceptorInfo.hpp> +#include <com/sun/star/lang/DisposedException.hpp> #include <osl/diagnose.h> #include <vcl/svapp.hxx> +#include <tools/diagnose_ex.h> + +using namespace com::sun::star; namespace framework{ @@ -185,7 +189,18 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css:: xMasterI->setSlaveDispatchProvider(xSlaveD); if (xSlaveI.is()) - xSlaveI->setMasterDispatchProvider(xMasterD); + { + try + { + xSlaveI->setMasterDispatchProvider(xMasterD); + } + catch (const lang::DisposedException&) + { + TOOLS_WARN_EXCEPTION("fwk.dispatch", + "InterceptionHelper::releaseDispatchProviderInterceptor: " + "xSlaveI is disposed: "); + } + } xInterceptor->setSlaveDispatchProvider (css::uno::Reference< css::frame::XDispatchProvider >()); xInterceptor->setMasterDispatchProvider(css::uno::Reference< css::frame::XDispatchProvider >()); diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 79d4a1eaf6b6..9ba91ff0ade0 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -41,6 +41,7 @@ #include <unoctitm.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/viewfrm.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -144,7 +145,14 @@ void BindDispatch_Impl::Release() { if ( xDisp.is() ) { - xDisp->removeStatusListener( static_cast<css::frame::XStatusListener*>(this), aURL ); + try + { + xDisp->removeStatusListener(static_cast<css::frame::XStatusListener*>(this), aURL); + } + catch (const lang::DisposedException&) + { + TOOLS_WARN_EXCEPTION("sfx", "BindDispatch_Impl::Release: xDisp is disposed: "); + } xDisp.clear(); } pCache = nullptr; |