summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-10-15 11:59:58 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-10-15 11:59:58 +0000
commit0d26e455a4674575f48580cedf5660b77754d3a1 (patch)
treec8327612dc915ea0db9746e0d8698399f5abaf01 /desktop/source
parent23c7891c76d5834778926b261a812ee0776aa80b (diff)
INTEGRATION: CWS sb71 (1.7.132); FILE MERGED
2007/09/07 13:58:07 sb 1.7.132.1: #i75466# Clean termination of bridges.
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/offacc/acceptor.cxx37
1 files changed, 28 insertions, 9 deletions
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index f4549f0ccf..f4f689a4b7 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: acceptor.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: obo $ $Date: 2006-10-12 14:14:59 $
+ * last change: $Author: vg $ $Date: 2007-10-15 12:59:58 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -83,7 +83,8 @@ static Reference<XInterface> getComponentContext( const Reference<XMultiServiceF
Mutex Acceptor::m_aMutex;
Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
- : m_aAcceptString()
+ : m_thread(NULL)
+ , m_aAcceptString()
, m_aConnectString()
, m_aProtocol()
, m_bInit(sal_False)
@@ -102,11 +103,28 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
Acceptor::~Acceptor()
{
- // at destruction time, m_rAcceptor will be destoyed, aborting any
- // pending accept calls in the accept thread thus leaving the run method
- // and ending the accept thread. Hence no expicit join here.
m_rAcceptor->stopAccepting();
-
+ oslThread t;
+ {
+ osl::MutexGuard g(m_aMutex);
+ t = m_thread;
+ }
+ osl_joinWithThread(t);
+ {
+ // Make the final state of m_bridges visible to this thread (since
+ // m_thread is joined, the code that follows is the only one left
+ // accessing m_bridges):
+ osl::MutexGuard g(m_aMutex);
+ }
+ for (;;) {
+ com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > b(
+ m_bridges.remove());
+ if (!b.is()) {
+ break;
+ }
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent >(
+ b, com::sun::star::uno::UNO_QUERY_THROW)->dispose();
+ }
}
void SAL_CALL Acceptor::run()
@@ -140,7 +158,8 @@ void SAL_CALL Acceptor::run()
// the bridge, it will be destructed.
Reference< XBridge > rBridge = m_rBridgeFactory->createBridge(
rtl::OUString() ,m_aProtocol ,rConnection ,rInstanceProvider );
-
+ osl::MutexGuard g(m_aMutex);
+ m_bridges.add(rBridge);
} catch (Exception&) {
// connection failed...
// something went wrong during connection setup.
@@ -180,7 +199,7 @@ void SAL_CALL Acceptor::initialize( const Sequence<Any>& aArguments )
m_aProtocol = m_aAcceptString.copy( nIndex1, nIndex2 - nIndex1 );
// start accepting in new thread...
- osl_createThread(workerfunc, this);
+ m_thread = osl_createThread(workerfunc, this);
m_bInit = sal_True;
bOk = sal_True;
}