framework/source/dispatch/interceptionhelper.cxx | 17 ++++++++++++++++- sfx2/source/control/statcach.cxx | 10 +++++++++- 2 files changed, 25 insertions(+), 2 deletions(-)
New commits: commit 58aac6e941c0a84e568c14e2aa276c867f725dff Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Jul 13 13:57:30 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Jul 13 15:47:46 2021 +0200 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 <vmik...@collabora.com> Tested-by: Jenkins 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits