summaryrefslogtreecommitdiff
path: root/binaryurp/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-19 18:06:16 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-19 18:11:47 +0200
commit184e4ef35641403fd293262ee413ceee37b3761a (patch)
treee8baab3b1cd1be4d11ed6e2789a4bdb23524ed0b /binaryurp/source
parent1706da9c8643fbbf42626a5f517ca753dd0ceffb (diff)
rhbz#1016758: Dispose bridges when disposing bridge factory
... (which happens when the service manager is disposed), so that no bridges can still run during exit. But this is so glaring that I wonder whether I missed the obvious when I originally wrote that code, or whether I rather miss the obvious now. So better let this rest for a while on master before deciding about any backports. Change-Id: I7c9ad6c8a53dfd1a7b702640920dcb0a9a2c3007
Diffstat (limited to 'binaryurp/source')
-rw-r--r--binaryurp/source/bridgefactory.cxx31
-rw-r--r--binaryurp/source/bridgefactory.hxx2
2 files changed, 33 insertions, 0 deletions
diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx
index 93cd22b3efea..c3972553c6be 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -116,6 +116,11 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
rtl::Reference< Bridge > b;
{
osl::MutexGuard g(m_aMutex);
+ if (rBHelper.bDisposed) {
+ throw css::lang::DisposedException(
+ "BridgeFactory disposed",
+ static_cast< cppu::OWeakObject * >(this));
+ }
if (named_.find(sName) != named_.end()) {
throw css::bridge::BridgeExistsException(
sName, static_cast< cppu::OWeakObject * >(this));
@@ -173,6 +178,32 @@ BridgeFactory::getExistingBridges() throw (css::uno::RuntimeException, std::exce
return s;
}
+void BridgeFactory::disposing() {
+ BridgeList l1;
+ BridgeMap l2;
+ {
+ osl::MutexGuard g(m_aMutex);
+ l1.swap(unnamed_);
+ l2.swap(named_);
+ }
+ for (BridgeList::iterator i(l1.begin()); i != l1.end(); ++i) {
+ try {
+ css::uno::Reference<css::lang::XComponent>(
+ *i, css::uno::UNO_QUERY_THROW)->dispose();
+ } catch (css::uno::Exception & e) {
+ SAL_WARN("binaryurp", "ignoring Exception " << e.Message);
+ }
+ }
+ for (BridgeMap::iterator i(l2.begin()); i != l2.end(); ++i) {
+ try {
+ css::uno::Reference<css::lang::XComponent>(
+ i->second, css::uno::UNO_QUERY_THROW)->dispose();
+ } catch (css::uno::Exception & e) {
+ SAL_WARN("binaryurp", "ignoring Exception " << e.Message);
+ }
+ }
+}
+
}
namespace {
diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx
index cb8f9f3078f6..8607626d8226 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -117,6 +117,8 @@ private:
com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
SAL_CALL getExistingBridges() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ void SAL_CALL disposing() SAL_OVERRIDE;
+
typedef
std::list<
com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >