diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-28 20:54:50 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-29 21:59:42 -0400 |
commit | 5a827671d16ff5e927fc3dd4a01e6c32ea05d891 (patch) | |
tree | 94fd6f0f2d8ab39dd4a779306a583cd8a8e882dc | |
parent | 699e97ebc4169546c63a48736d953349df69fdf3 (diff) |
Avoid static local of a singleton. This crashed writer unit tests.
Change-Id: I7c5f2d372676cdb317a8dad636bf1aab7dd5db37
-rw-r--r-- | basic/source/classes/sb.cxx | 4 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 26 |
2 files changed, 22 insertions, 8 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 5a37bbcf0291..3d3842840b32 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -128,7 +128,9 @@ void DocBasicItem::stopListening() if( mbDisposed ) return; mbDisposed = true; Any aThisComp; - mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp ); + if (!mrDocBasic.GetUNOConstant("ThisComponent", aThisComp)) + return; + Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY ); if( xCloseBC.is() ) { diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 45e96a24b8dd..086445a25b3e 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -2427,19 +2427,31 @@ SbUnoObject::~SbUnoObject() // pass the introspection on Demand void SbUnoObject::doIntrospection( void ) { - static Reference< XIntrospection > xIntrospection; - if( !bNeedIntrospection ) return; - bNeedIntrospection = false; - if( !xIntrospection.is() ) + Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); + + if (!xContext.is()) + return; + + + // get the introspection service + Reference<XIntrospection> xIntrospection; + + try + { + xIntrospection = theIntrospection::get(xContext); + } + catch ( const css::uno::DeploymentException& ex ) { - // get the introspection service - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); - xIntrospection = theIntrospection::get( xContext ); } + if (!xIntrospection.is()) + return; + + bNeedIntrospection = false; + // pass the introspection try { |