diff options
-rw-r--r-- | comphelper/source/misc/asyncquithandler.cxx | 9 | ||||
-rw-r--r-- | extensions/Library_oleautobridge.mk | 1 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.cxx | 68 | ||||
-rw-r--r-- | include/comphelper/asyncquithandler.hxx | 8 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 4 |
5 files changed, 1 insertions, 89 deletions
diff --git a/comphelper/source/misc/asyncquithandler.cxx b/comphelper/source/misc/asyncquithandler.cxx index fd53cbd9bf4b..a04534ec92e8 100644 --- a/comphelper/source/misc/asyncquithandler.cxx +++ b/comphelper/source/misc/asyncquithandler.cxx @@ -24,10 +24,7 @@ #include <comphelper/asyncquithandler.hxx> #include <comphelper/processfactory.hxx> -AsyncQuitHandler::AsyncQuitHandler() - : mbForceQuit(false) -{ -} +AsyncQuitHandler::AsyncQuitHandler() {} AsyncQuitHandler& AsyncQuitHandler::instance() { @@ -42,10 +39,6 @@ void AsyncQuitHandler::QuitApplication() xDesktop->terminate(); } -void AsyncQuitHandler::SetForceQuit() { mbForceQuit = true; } - -bool AsyncQuitHandler::IsForceQuit() const { return mbForceQuit; } - IMPL_STATIC_LINK_NOARG(AsyncQuitHandler, OnAsyncQuit, void*, void) { QuitApplication(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/Library_oleautobridge.mk b/extensions/Library_oleautobridge.mk index 6aaf5555e250..ec59f715c504 100644 --- a/extensions/Library_oleautobridge.mk +++ b/extensions/Library_oleautobridge.mk @@ -35,7 +35,6 @@ $(eval $(call gb_Library_use_libraries,oleautobridge,\ cppuhelper \ cppu \ sal \ - tl \ )) $(eval $(call gb_Library_use_system_win32_libs,oleautobridge,\ diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 595d4276e3c4..a6cd0677d6ae 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -57,13 +57,9 @@ #include <salhelper/simplereferenceobject.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> -#include <tools/diagnose_ex.h> #include <sal/log.hxx> #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/beans/PropertyConcept.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/TerminationVetoException.hpp> -#include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/lang/NoSuchMethodException.hpp> #include <com/sun/star/script/CannotConvertException.hpp> #include <com/sun/star/script/FailReason.hpp> @@ -86,7 +82,6 @@ #include <osl/interlck.h> #include <com/sun/star/uno/genfunc.h> #include <comphelper/automationinvokedzone.hxx> -#include <comphelper/asyncquithandler.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/profilezone.hxx> #include <comphelper/windowsdebugoutput.hxx> @@ -117,64 +112,6 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource); static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource); static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr); -namespace { - -class TerminationVetoer : public WeakImplHelper<css::frame::XTerminateListener> -{ -public: - int mnCount; - -private: - TerminationVetoer() - : mnCount(0) - { - try - { - Reference< css::frame::XDesktop > xDesktop = - css::frame::Desktop::create( comphelper::getProcessComponentContext() ); - xDesktop->addTerminateListener( this ); - } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("extensions.olebridge"); - } - } - -public: - static rtl::Reference< TerminationVetoer > get() - { - static rtl::Reference< TerminationVetoer > aInstance( new TerminationVetoer ); - - return aInstance; - } - - // XTerminateListener - void SAL_CALL queryTermination( const EventObject& ) override - { - SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: count=" << mnCount); - // Always veto termination while an OLE object is active, except if it is an OLE object that - // has asked us to quit. - if (!AsyncQuitHandler::instance().IsForceQuit() && mnCount > 0) - { - SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: Throwing!"); - throw css::frame::TerminationVetoException(); - } - } - - void SAL_CALL notifyTermination( const EventObject& ) override - { - // ??? - } - - // XEventListener - void SAL_CALL disposing( const css::lang::EventObject& ) override - { - // ??? - } -}; - -} - /* Does not throw any exceptions. Param pInfo can be NULL. */ @@ -193,8 +130,6 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference<XMultiServiceFactory> const UnoConversionUtilities<InterfaceOleWrapper>( xFactory, unoWrapperClass, comWrapperClass), m_defaultValueType( 0) { - TerminationVetoer::get()->mnCount++; - SAL_INFO("extensions.olebridge", "InterfaceOleWrapper CTOR, count=" << TerminationVetoer::get()->mnCount); } InterfaceOleWrapper::~InterfaceOleWrapper() @@ -204,9 +139,6 @@ InterfaceOleWrapper::~InterfaceOleWrapper() auto it = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get())); if(it != UnoObjToWrapperMap.end()) UnoObjToWrapperMap.erase(it); - - TerminationVetoer::get()->mnCount--; - SAL_INFO("extensions.olebridge", "InterfaceOleWrapper DTOR, count=" << TerminationVetoer::get()->mnCount); } COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, void ** ppv) diff --git a/include/comphelper/asyncquithandler.hxx b/include/comphelper/asyncquithandler.hxx index 9d994d177592..ce3db23a147a 100644 --- a/include/comphelper/asyncquithandler.hxx +++ b/include/comphelper/asyncquithandler.hxx @@ -29,8 +29,6 @@ class COMPHELPER_DLLPUBLIC AsyncQuitHandler { AsyncQuitHandler(); - bool mbForceQuit; - public: AsyncQuitHandler(const AsyncQuitHandler&) = delete; const AsyncQuitHandler& operator=(const AsyncQuitHandler&) = delete; @@ -38,12 +36,6 @@ public: static AsyncQuitHandler& instance(); static void QuitApplication(); - // Hack for the TerminationVetoer in extensions/source/ole/unoobjw.cxx. When it is an Automation - // client itself that explicitly requests a quit (see VbaApplicationBase::Quit()), we do quit. - // The flag can only be set to true, not back to false. - void SetForceQuit(); - bool IsForceQuit() const; - DECL_STATIC_LINK(AsyncQuitHandler, OnAsyncQuit, void*, void); }; diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 836781c95d78..382ad3eea6ab 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -471,13 +471,9 @@ void VbaApplicationBase::Quit() { // This is the case of a call from an (OLE) Automation client. - // When an Automation client itself asks the process to quit, it should obey it. - AsyncQuitHandler::instance().SetForceQuit(); - // TODO: Probably we should just close any document windows open by the "application" // (Writer or Calc) the call being handled is for. And only then, if no document windows // are left open, quit the actual LibreOffice application. - Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ) ); } } |