Tag: cws_src680_qiq User: fs Date: 06/05/17 04:48:40 Modified: /dba/dbaccess/source/ui/misc/ singledoccontroller.cxx
Log: SharedConnection (during #i51143#) File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: singledoccontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/singledoccontroller.cxx?r1=1.16&r2=1.16.118.1 Delta lines: +19 -35 --------------------- --- singledoccontroller.cxx 23 Sep 2005 12:41:29 -0000 1.16 +++ singledoccontroller.cxx 17 May 2006 11:48:37 -0000 1.16.118.1 @@ -4,9 +4,9 @@ * * $RCSfile: singledoccontroller.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.16.118.1 $ * - * last change: $Author: hr $ $Date: 2005/09/23 12:41:29 $ + * last change: $Author: fs $ $Date: 2006/05/17 11:48:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -149,14 +149,14 @@ OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB) :OSingleDocumentController_CBASE( _rxORB ) ,OSingleDocumentController_PBASE( getBroadcastHelper() ) - ,m_bOwnConnection( sal_False ) ,m_bSuspended( sal_False ) ,m_bEditable(sal_True) ,m_bModified(sal_False) { - registerProperty( PROPERTY_ACTIVECONNECTION, PROPERTY_ID_ACTIVECONNECTION, PropertyAttribute::READONLY | PropertyAttribute::BOUND, - &m_xConnection, ::getCppuType( &m_xConnection ) ); +// registerProperty( PROPERTY_ACTIVECONNECTION, PROPERTY_ID_ACTIVECONNECTION, PropertyAttribute::READONLY | PropertyAttribute::BOUND, +// &m_xConnection, ::getCppuType( &m_xConnection ) ); + // TODO: is this still needed? } //-------------------------------------------------------------------- @@ -235,8 +235,8 @@ if ( isConnected() ) disconnect(); - m_xConnection = _rxForeignConn; - m_bOwnConnection = sal_False; + m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership ); + m_aSdbMetaData.reset( m_xConnection ); startConnectionListening( m_xConnection ); // get the data source the connection belongs to @@ -272,18 +272,9 @@ OSL_ENSURE(!m_bSuspended, "Cannot reconnect while suspended!"); OConnectionChangeBroadcaster( this ); - stopConnectionListening(m_xConnection); - if ( m_bOwnConnection ) - { - try - { - ::comphelper::disposeComponent( m_xConnection ); - } - catch( const Exception& ) { /* allowed: if we reconnect because the old connection has been disposed .... */ } - } - m_xConnection = NULL; - m_bOwnConnection = sal_False; - + stopConnectionListening( m_xConnection ); + m_aSdbMetaData.reset( NULL ); + m_xConnection.clear(); // reconnect sal_Bool bReConnect = sal_True; @@ -296,8 +287,8 @@ // now really reconnect ... if ( bReConnect ) { - m_xConnection = connect( Reference<XDataSource>(m_xDataSource,UNO_QUERY), sal_True ); - m_bOwnConnection = m_xConnection.is(); + m_xConnection.reset( connect( Reference<XDataSource>(m_xDataSource,UNO_QUERY), sal_True ), SharedConnection::TakeOwnership ); + m_aSdbMetaData.reset( m_xConnection ); } // invalidate all slots @@ -310,16 +301,8 @@ OConnectionChangeBroadcaster( this ); stopConnectionListening(m_xConnection); - try - { - if ( m_bOwnConnection ) - ::comphelper::disposeComponent( m_xConnection ); - } - catch(const Exception&) - { - } - m_xConnection = NULL; - m_bOwnConnection = sal_False; + m_aSdbMetaData.reset( NULL ); + m_xConnection.clear(); InvalidateAll(); } @@ -372,7 +355,8 @@ } else { - m_bOwnConnection = sal_False; // this prevents the "disposeComponent" call in disconnect + m_xConnection.reset( m_xConnection, SharedConnection::NoTakeOwnership ); + // this prevents the "disposeComponent" call in disconnect disconnect(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
