From 50b694c8e10d94e967aae802720eb01e3349a134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Mon, 5 Sep 2005 08:05:12 +0000 Subject: [PATCH] INTEGRATION: CWS hr18 (1.1.252); FILE MERGED 2005/08/15 13:33:08 hr 1.1.252.2: #i53224#: OEventListenerAdapter::stopComponentListening(): fix dispose loop, 2nd try 2005/08/11 16:23:46 hr 1.1.252.1: #53224#: OEventListenerAdapter::stopComponentListening(): fix dispose loop --- unotools/source/misc/eventlisteneradapter.cxx | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/unotools/source/misc/eventlisteneradapter.cxx b/unotools/source/misc/eventlisteneradapter.cxx index a2d9d229d38b..cf76151474c4 100644 --- a/unotools/source/misc/eventlisteneradapter.cxx +++ b/unotools/source/misc/eventlisteneradapter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: eventlisteneradapter.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2001-04-19 16:13:35 $ + * last change: $Author: rt $ $Date: 2005-09-05 09:05:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,24 +169,23 @@ namespace utl //--------------------------------------------------------------------- void OEventListenerAdapter::stopComponentListening( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp ) { - for ( ::std::vector< void* >::iterator aDisposeLoop = m_pImpl->aListeners.begin(); - aDisposeLoop != m_pImpl->aListeners.end(); - ++aDisposeLoop - ) - { - OEventListenerImpl* pListenerImpl = static_cast< OEventListenerImpl* >(*aDisposeLoop); - if (pListenerImpl->getComponent().get() == _rxComp.get()) - { - ::std::vector< void* >::iterator aPrevious(aDisposeLoop); - --aPrevious; + if ( m_pImpl->aListeners.empty() ) + return; + ::std::vector< void* >::iterator dispose = m_pImpl->aListeners.begin(); + do + { + OEventListenerImpl* pListenerImpl = static_cast< OEventListenerImpl* >( *dispose ); + if ( pListenerImpl->getComponent().get() == _rxComp.get() ) + { pListenerImpl->dispose(); pListenerImpl->release(); - m_pImpl->aListeners.erase(aDisposeLoop); - - aDisposeLoop = aPrevious; + dispose = m_pImpl->aListeners.erase( dispose ); } + else + ++dispose; } + while ( dispose != m_pImpl->aListeners.end() ); } //--------------------------------------------------------------------- @@ -221,11 +220,3 @@ namespace utl //......................................................................... } // namespace utl //......................................................................... - -/************************************************************************* - * history: - * $Log: not supported by cvs2svn $ - * - * Revision 1.0 19.04.01 16:26:16 fs - ************************************************************************/ -