User: rt Date: 05/10/24 01:31:19 Modified: /dba/dbaccess/source/ui/browser/ unodatbr.cxx
Log: INTEGRATION: CWS dba201d (1.172.2); FILE MERGED 2005/10/05 10:20:38 fs 1.172.2.1: #i55493# flush the connection before disconnecting, if possible File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: unodatbr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.172&r2=1.173 Delta lines: +39 -14 --------------------- --- unodatbr.cxx 23 Sep 2005 12:22:12 -0000 1.172 +++ unodatbr.cxx 24 Oct 2005 08:31:15 -0000 1.173 @@ -90,6 +90,9 @@ #ifndef _COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_ #include <com/sun/star/frame/XLayoutManager.hpp> #endif +#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_ +#include <com/sun/star/util/XFlushable.hpp> +#endif #ifndef _URLOBJ_HXX //autogen #include <tools/urlobj.hxx> #endif @@ -2874,6 +2877,41 @@ } // ------------------------------------------------------------------------- +void SbaTableQueryBrowser::impl_releaseConnection( SharedConnection& _rxConnection ) +{ + // remove as event listener + Reference< XComponent > xComponent( _rxConnection, UNO_QUERY ); + if ( xComponent.is() ) + { + Reference< XEventListener > xListener( static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY ); + xComponent->removeEventListener( xListener ); + } + + try + { + // temporary (hopefully!) hack for #i55274# + Reference< XFlushable > xFlush( _rxConnection, UNO_QUERY ); + if ( xFlush.is() ) + xFlush->flush(); + } + catch( const Exception& e ) + { + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OString sMessage( "SbaTableQueryBrowser::impl_releaseConnection: caught an exception!\n" ); + sMessage += "message:\n"; + sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), osl_getThreadTextEncoding() ); + OSL_ENSURE( false, sMessage ); + #else + e; // make compiler happy + #endif + } + + // clear + _rxConnection.clear(); + // will implicitly dispose if we have the ownership, since xConnection is a SharedConnection +} + +// ------------------------------------------------------------------------- void SbaTableQueryBrowser::disposeConnection( SvLBoxEntry* _pDSEntry ) { DBG_ASSERT( _pDSEntry, "SbaTableQueryBrowser::disposeConnection: invalid entry (NULL)!" ); @@ -2884,25 +2922,12 @@ DBTreeListModel::DBTreeListUserData* pTreeListData = static_cast< DBTreeListModel::DBTreeListUserData* >( _pDSEntry->GetUserData() ); if ( pTreeListData ) { - // remove as event listener - Reference< XComponent > xComponent( pTreeListData->xConnection, UNO_QUERY ); - if ( xComponent.is() ) - { - Reference< XEventListener > xListener( static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY ); - xComponent->removeEventListener( xListener ); - } - - // dispose - pTreeListData->xConnection.clear(); - // will implicitly dispose, since xConnection is a SharedConnection + impl_releaseConnection( pTreeListData->xConnection ); // release the model-controller-connection DBG_ASSERT( !pTreeListData->aController.empty(), "SbaTableQueryBrowser::disposeConnection: there's a connection, but we didn't register ourself as controller at the model?!" ); pTreeListData->aController.clear(); - - // clear - pTreeListData->xConnection.clear(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
