diff options
Diffstat (limited to 'vcl/source/app')
-rw-r--r-- | vcl/source/app/svapp.cxx | 10 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b27b9c31174e..50cda48010c6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -68,6 +68,7 @@ #include "comphelper/solarmutex.hxx" #include "osl/process.h" +#include <cassert> #include <utility> using namespace ::com::sun::star; @@ -1654,6 +1655,15 @@ Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM return pSVData->mpDefInst->createFolderPicker( xSM ); } +void Application::setDeInitHook(Link const & hook) { + ImplSVData * pSVData = ImplGetSVData(); + assert(!pSVData->maDeInitHook.IsSet()); + pSVData->maDeInitHook = hook; + // Fake this for VCLXToolkit ctor instantiated from + // postprocess/CppunitTest_services.mk: + pSVData->maAppData.mbInAppMain = true; +} + // helper method to allow inline constructor even for pWindow!=NULL case void ImplDelData::AttachToWindow( const Window* pWindow ) { diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 25c8f995a0db..0acb009292a5 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cassert> + #include "rtl/logfile.hxx" #include <osl/file.hxx> @@ -464,13 +468,20 @@ void DeInitVCL() } } - if( pSVData->mpApp ) + if( pSVData->mpApp || pSVData->maDeInitHook.IsSet() ) { sal_uLong nCount = Application::ReleaseSolarMutex(); // call deinit to deinitialize application class // soffice/sfx implementation disposes the global service manager // Warning: After this call you can't call uno services - pSVData->mpApp->DeInit(); + if( pSVData->mpApp ) + { + pSVData->mpApp->DeInit(); + } + if( pSVData->maDeInitHook.IsSet() ) + { + pSVData->maDeInitHook.Call(0); + } Application::AcquireSolarMutex(nCount); } |