summaryrefslogtreecommitdiff
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-29 22:00:48 -0400
commit9832a2482f157d34f7323327dc20eaf5e11da3fd (patch)
tree6e03b6b7eb4f6144184007486aa6797802cb04db
parentad9e67a7c08f9ceb3b4c228e3d9241c4ed54a7c8 (diff)
Detach all DocBasicItem objects upon process termination.
To prevent rogue DocBasicItem objects (which are global objects) from attempting to stop listening after the main app is dead. Change-Id: I68a667137ca4e0eff18278f4d2d5dd67466eaf34 (cherry picked from commit a916b6ff7fdf1bcb1182e72e4a5bf2f901c698da)
-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 bb14e03470a2..9fa787cd8d85 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: */