Tag: cws_src680_dba201d User: fs Date: 05/10/05 03:20:43 Modified: /dba/dbaccess/source/ui/browser/ unodatbr.cxx
Log: #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.172.2.1 Delta lines: +42 -17 --------------------- --- unodatbr.cxx 23 Sep 2005 12:22:12 -0000 1.172 +++ unodatbr.cxx 5 Oct 2005 10:20:38 -0000 1.172.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.172 $ + * $Revision: 1.172.2.1 $ * - * last change: $Author: hr $ $Date: 2005/09/23 12:22:12 $ + * last change: $Author: fs $ $Date: 2005/10/05 10:20:38 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -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]
