summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-06-04 08:45:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-06-04 08:55:12 +0200
commit369d95931f42267eb2f55e066f58ee859183025d (patch)
treef6047cebccb31dea56653bb1adfa08f853d09918 /vcl
parent9e13afeaf67b9c07762692cd858de4b577234ab7 (diff)
DeInitVCL at end of tests
This required some changes to the framework: * Init-/DeInitVCL is no longer done per individual test in BootstrapFixture, but once per CppunitTest invocation in a new vclbootstrapprotector (similarly to the exisiting unobootstrapprotector). CppunitTests that need VCL now need to declare gb_CppunitTest_use_vcl. * For things to work properly, the UNO component context needs to be disposed from within DeInitVCL (cf. Desktop's Application::DeInit called from DeInitVCL). The easiest solution was to introduce an Application::setDeInitHook (where the hook is called from DeInitVCL) specifically for vclbootstrapprotector to call. * PythonTests don't (yet) call DeInitVCL; they still hook into BootstrapFixture's original test_init functionality (to call InitVCL), and do not make use of the vclbootstrapprotector. Change-Id: I4f3a3c75db30b58c1cd49d81c51db14902ed68b2
Diffstat (limited to 'vcl')
-rw-r--r--vcl/CppunitTest_vcl_complextext.mk1
-rw-r--r--vcl/CppunitTest_vcl_filters_test.mk1
-rw-r--r--vcl/CppunitTest_vcl_wmf_test.mk1
-rw-r--r--vcl/inc/svdata.hxx2
-rw-r--r--vcl/source/app/svapp.cxx10
-rw-r--r--vcl/source/app/svmain.cxx15
6 files changed, 28 insertions, 2 deletions
diff --git a/vcl/CppunitTest_vcl_complextext.mk b/vcl/CppunitTest_vcl_complextext.mk
index dd85f1292105..60011a541a9e 100644
--- a/vcl/CppunitTest_vcl_complextext.mk
+++ b/vcl/CppunitTest_vcl_complextext.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_api,vcl_complextext,\
))
$(eval $(call gb_CppunitTest_use_ure,vcl_complextext))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_complextext))
$(eval $(call gb_CppunitTest_use_components,vcl_complextext,\
configmgr/source/configmgr \
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 6edcff216e36..53122b1a73da 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_api,vcl_filters_test,\
))
$(eval $(call gb_CppunitTest_use_ure,vcl_filters_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_filters_test))
$(eval $(call gb_CppunitTest_use_components,vcl_filters_test,\
configmgr/source/configmgr \
diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/vcl/CppunitTest_vcl_wmf_test.mk
index f7272c9f6e0d..5fb4e72acea6 100644
--- a/vcl/CppunitTest_vcl_wmf_test.mk
+++ b/vcl/CppunitTest_vcl_wmf_test.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_CppunitTest_use_api,vcl_wmf_test,\
))
$(eval $(call gb_CppunitTest_use_ure,vcl_wmf_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_wmf_test))
$(eval $(call gb_CppunitTest_use_components,vcl_wmf_test,\
configmgr/source/configmgr \
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 21e6c548c7cd..b505ad6b6add 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -337,6 +337,8 @@ struct ImplSVData
::vcl::SettingsConfigItem* mpSettingsConfigItem;
std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
boost::unordered_map< int, OUString >* mpPaperNames;
+
+ Link maDeInitHook;
};
void ImplInitSVData();
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);
}