summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-05-28 22:33:29 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-05-28 22:50:46 -0400
commitddfcc1a7b1573cb786e32595dbeb0d7f3df91025 (patch)
treee221ec99cba852c38b07fad9c2e1f7ed308c1be7
parentAvoid static local of a singleton. This crashed writer unit tests. (diff)
downloadcore-private/kohei/headless-perf.tar.gz
core-private/kohei/headless-perf.zip
Detach all DocBasicItem objects upon process termination. private/kohei/headless-perf
To prevent rogue DocBasicItem objects (which are global objects) from attempting to stop listening after the main app is dead. Change-Id: I68a667137ca4e0eff18278f4d2d5dd67466eaf34
-rw-r--r--basic/source/classes/sb.cxx16
-rw-r--r--desktop/Library_sofficeapp.mk1
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--include/basic/sbstar.hxx2
-rw-r--r--unotest/Library_unotest.mk1
-rw-r--r--unotest/source/cpp/bootstrapfixturebase.cxx2
6 files changed, 23 insertions, 1 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3d3842840b32..922df3e82b8e 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -80,6 +80,11 @@ public:
void startListening();
void stopListening();
+ void setDisposed( bool bDisposed )
+ {
+ mbDisposed = bDisposed;
+ }
+
virtual void SAL_CALL queryClosing( const lang::EventObject& rSource, sal_Bool bGetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL notifyClosing( const lang::EventObject& rSource ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL disposing( const lang::EventObject& rSource ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -2007,7 +2012,16 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
return xModel;
}
-
+void StarBASIC::DetachAllDocBasicItems()
+{
+ DocBasicItemMap& rItems = GaDocBasicItems::get();
+ DocBasicItemMap::iterator it = rItems.begin(), itEnd = rItems.end();
+ for (; it != itEnd; ++it)
+ {
+ DocBasicItemRef xItem = it->second;
+ xItem->setDisposed(true);
+ }
+}
// #118116 Implementation Collection object
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 0c6c3e71f0ba..01950fcc5b0a 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
i18nlangtag \
sal \
salhelper \
+ sb \
sfx \
svl \
svt \
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 290312d9b0e4..b6c4e8c1cdbb 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -98,6 +98,7 @@
#include <sfx2/app.hxx>
#include <svl/itemset.hxx>
#include <svl/eitem.hxx>
+#include <basic/sbstar.hxx>
#include <svtools/fontsubstconfig.hxx>
#include <svtools/accessibilityoptions.hxx>
@@ -1766,6 +1767,7 @@ int Desktop::doShutdown()
// with the solar mutex unlocked, to avoid deadlock:
sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
DeregisterServices();
+ StarBASIC::DetachAllDocBasicItems();
Application::AcquireSolarMutex(nAcquireCount);
// be sure that path/language options gets destroyed before
// UCB is deinitialized
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 2eec72bae613..cb1d49a72bf4 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -174,6 +174,8 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
GetModelFromBasic( SbxObject* pBasic );
+
+ static void DetachAllDocBasicItems();
};
typedef tools::SvRef<StarBASIC> StarBASICRef;
diff --git a/unotest/Library_unotest.mk b/unotest/Library_unotest.mk
index cfc6fc197002..3f9d99b6f0a3 100644
--- a/unotest/Library_unotest.mk
+++ b/unotest/Library_unotest.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,unotest,\
cppu \
cppuhelper \
sal \
+ sb \
$(gb_UWINAPI) \
))
diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
index 87a72a725eb0..c407dc677b20 100644
--- a/unotest/source/cpp/bootstrapfixturebase.cxx
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -15,6 +15,7 @@
#include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx>
+#include <basic/sbstar.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -105,6 +106,7 @@ void test::BootstrapFixtureBase::setUp()
void test::BootstrapFixtureBase::tearDown()
{
+ StarBASIC::DetachAllDocBasicItems();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */