Kaydet (Commit) 9832a248 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
(cherry picked from commit a916b6ff)
üst ad9e67a7
...@@ -80,6 +80,11 @@ public: ...@@ -80,6 +80,11 @@ public:
void startListening(); void startListening();
void stopListening(); 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 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 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; 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 ) ...@@ -2007,7 +2012,16 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
return xModel; 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 // #118116 Implementation Collection object
......
...@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\ ...@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
i18nlangtag \ i18nlangtag \
sal \ sal \
salhelper \ salhelper \
sb \
sfx \ sfx \
svl \ svl \
svt \ svt \
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <svl/itemset.hxx> #include <svl/itemset.hxx>
#include <svl/eitem.hxx> #include <svl/eitem.hxx>
#include <basic/sbstar.hxx>
#include <svtools/fontsubstconfig.hxx> #include <svtools/fontsubstconfig.hxx>
#include <svtools/accessibilityoptions.hxx> #include <svtools/accessibilityoptions.hxx>
...@@ -1766,6 +1767,7 @@ int Desktop::doShutdown() ...@@ -1766,6 +1767,7 @@ int Desktop::doShutdown()
// with the solar mutex unlocked, to avoid deadlock: // with the solar mutex unlocked, to avoid deadlock:
sal_uLong nAcquireCount = Application::ReleaseSolarMutex(); sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
DeregisterServices(); DeregisterServices();
StarBASIC::DetachAllDocBasicItems();
Application::AcquireSolarMutex(nAcquireCount); Application::AcquireSolarMutex(nAcquireCount);
// be sure that path/language options gets destroyed before // be sure that path/language options gets destroyed before
// UCB is deinitialized // UCB is deinitialized
......
...@@ -174,6 +174,8 @@ public: ...@@ -174,6 +174,8 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
GetModelFromBasic( SbxObject* pBasic ); GetModelFromBasic( SbxObject* pBasic );
static void DetachAllDocBasicItems();
}; };
typedef tools::SvRef<StarBASIC> StarBASICRef; typedef tools::SvRef<StarBASIC> StarBASICRef;
......
...@@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,unotest,\ ...@@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,unotest,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
sb \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <basic/sbstar.hxx>
#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
...@@ -105,6 +106,7 @@ void test::BootstrapFixtureBase::setUp() ...@@ -105,6 +106,7 @@ void test::BootstrapFixtureBase::setUp()
void test::BootstrapFixtureBase::tearDown() void test::BootstrapFixtureBase::tearDown()
{ {
StarBASIC::DetachAllDocBasicItems();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* 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