Kaydet (Commit) a916b6ff authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 5a827671
......@@ -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
......
......@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
i18nlangtag \
sal \
salhelper \
sb \
sfx \
svl \
svt \
......
......@@ -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
......
......@@ -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;
......
......@@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,unotest,\
cppu \
cppuhelper \
sal \
sb \
$(gb_UWINAPI) \
))
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment