[Libreoffice-commits] core.git: dbaccess/source
Noel Grandin
noel at peralex.com
Thu Jun 9 06:44:21 UTC 2016
dbaccess/source/core/dataaccess/ModelImpl.cxx | 17 +++------
dbaccess/source/core/dataaccess/ModelImpl.hxx | 2 -
dbaccess/source/core/dataaccess/documentdefinition.cxx | 30 ++++++-----------
dbaccess/source/core/dataaccess/documentdefinition.hxx | 4 +-
dbaccess/source/ui/app/AppController.cxx | 13 ++-----
dbaccess/source/ui/app/AppController.hxx | 4 +-
dbaccess/source/ui/browser/brwctrlr.cxx | 15 +++-----
dbaccess/source/ui/inc/brwctrlr.hxx | 4 +-
8 files changed, 35 insertions(+), 54 deletions(-)
New commits:
commit 10aaf339862776c9906e195d34c238187f0ea6ac
Author: Noel Grandin <noel at peralex.com>
Date: Wed Jun 8 10:43:42 2016 +0200
convert some manual ref-counting in dbaccess
Change-Id: I2df7b6b79bff4a5c7358288518c5518b6a7032bf
Reviewed-on: https://gerrit.libreoffice.org/26051
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 34b4b5b..4577776 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -395,7 +395,6 @@ void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& So
ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _rxContext, ODatabaseContext& _rDBContext )
:m_xModel()
,m_xDataSource()
- ,m_pStorageAccess( nullptr )
,m_aMutex()
,m_aMutexFacade( m_aMutex )
,m_aContainer(4)
@@ -430,7 +429,6 @@ ODatabaseModelImpl::ODatabaseModelImpl(
)
:m_xModel()
,m_xDataSource()
- ,m_pStorageAccess( nullptr )
,m_aMutex()
,m_aMutexFacade( m_aMutex )
,m_aContainer(4)
@@ -615,11 +613,10 @@ void ODatabaseModelImpl::reset()
::std::vector< TContentPtr > aEmptyContainers( 4 );
m_aContainer.swap( aEmptyContainers );
- if ( m_pStorageAccess )
+ if ( m_pStorageAccess.is() )
{
m_pStorageAccess->dispose();
- m_pStorageAccess->release();
- m_pStorageAccess = nullptr;
+ m_pStorageAccess.clear();
}
}
@@ -723,11 +720,10 @@ void ODatabaseModelImpl::dispose()
DBG_UNHANDLED_EXCEPTION();
}
- if ( m_pStorageAccess )
+ if ( m_pStorageAccess.is() )
{
m_pStorageAccess->dispose();
- m_pStorageAccess->release();
- m_pStorageAccess = nullptr;
+ m_pStorageAccess.clear();
}
}
@@ -857,12 +853,11 @@ Reference< XStorage > ODatabaseModelImpl::getOrCreateRootStorage()
DocumentStorageAccess* ODatabaseModelImpl::getDocumentStorageAccess()
{
- if ( !m_pStorageAccess )
+ if ( !m_pStorageAccess.is() )
{
m_pStorageAccess = new DocumentStorageAccess( *this );
- m_pStorageAccess->acquire();
}
- return m_pStorageAccess;
+ return m_pStorageAccess.get();
}
void ODatabaseModelImpl::modelIsDisposing( const bool _wasInitialized, ResetModelAccess )
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index aca2f56..c57042d 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -170,7 +170,7 @@ private:
css::uno::WeakReference< css::frame::XModel > m_xModel;
css::uno::WeakReference< css::sdbc::XDataSource > m_xDataSource;
- DocumentStorageAccess* m_pStorageAccess;
+ rtl::Reference<DocumentStorageAccess> m_pStorageAccess;
::comphelper::SharedMutex m_aMutex;
VosMutexFacade m_aMutexFacade;
::std::vector< TContentPtr > m_aContainer; // one for each ObjectType
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index e421a2b..1ebbb68 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -407,12 +407,10 @@ ODocumentDefinition::ODocumentDefinition( const Reference< XInterface >& _rxCont
const TContentPtr& _pImpl, bool _bForm )
:OContentHelper(_xORB,_rxContainer,_pImpl)
,OPropertyStateContainer(OContentHelper::rBHelper)
- ,m_pInterceptor(nullptr)
,m_bForm(_bForm)
,m_bOpenInDesign(false)
,m_bInExecute(false)
,m_bRemoveListener(false)
- ,m_pClientHelper(nullptr)
{
registerProperties();
}
@@ -435,11 +433,10 @@ ODocumentDefinition::~ODocumentDefinition()
dispose();
}
- if ( m_pInterceptor )
+ if ( m_pInterceptor.is() )
{
m_pInterceptor->dispose();
- m_pInterceptor->release();
- m_pInterceptor = nullptr;
+ m_pInterceptor.clear();
}
}
@@ -458,11 +455,10 @@ void ODocumentDefinition::closeObject()
{
}
m_xEmbeddedObject = nullptr;
- if ( m_pClientHelper )
+ if ( m_pClientHelper.is() )
{
m_pClientHelper->resetClient(nullptr);
- m_pClientHelper->release();
- m_pClientHelper = nullptr;
+ m_pClientHelper.clear();
}
}
}
@@ -1492,16 +1488,14 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
const Sequence< PropertyValue >& i_rOpenCommandArguments, Sequence< PropertyValue >& _out_rEmbeddedObjectDescriptor )
{
// (re-)create interceptor, and put it into the descriptor of the embedded object
- if ( m_pInterceptor )
+ if ( m_pInterceptor.is() )
{
m_pInterceptor->dispose();
- m_pInterceptor->release();
- m_pInterceptor = nullptr;
+ m_pInterceptor.clear();
}
m_pInterceptor = new OInterceptor( this );
- m_pInterceptor->acquire();
- Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor;
+ Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor.get();
::comphelper::NamedValueCollection aEmbeddedDescriptor;
aEmbeddedDescriptor.put( "OutplaceDispatchInterceptor", xInterceptor );
@@ -1625,12 +1619,11 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
),UNO_QUERY);
if ( m_xEmbeddedObject.is() )
{
- if ( !m_pClientHelper )
+ if ( !m_pClientHelper.is() )
{
m_pClientHelper = new OEmbeddedClientHelper(this);
- m_pClientHelper->acquire();
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper;
+ Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
m_xEmbeddedObject->setClientSite(xClient);
m_xEmbeddedObject->changeState(EmbedStates::RUNNING);
if ( bSetSize )
@@ -1648,12 +1641,11 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
sal_Int32 nCurrentState = m_xEmbeddedObject->getCurrentState();
if ( nCurrentState == EmbedStates::LOADED )
{
- if ( !m_pClientHelper )
+ if ( !m_pClientHelper.is() )
{
m_pClientHelper = new OEmbeddedClientHelper(this);
- m_pClientHelper->acquire();
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper;
+ Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
m_xEmbeddedObject->setClientSite(xClient);
Sequence< PropertyValue > aEmbeddedObjectDescriptor;
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx
index 362bd1e..de71216 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -64,12 +64,12 @@ class ODocumentDefinition
css::uno::Reference< css::embed::XStateChangeListener > m_xListener;
css::uno::Reference< css::sdbc::XConnection > m_xLastKnownConnection;
- OInterceptor* m_pInterceptor;
+ rtl::Reference<OInterceptor> m_pInterceptor;
bool m_bForm; // <TRUE/> if it is a form
bool m_bOpenInDesign;
bool m_bInExecute;
bool m_bRemoveListener;
- OEmbeddedClientHelper* m_pClientHelper;
+ rtl::Reference<OEmbeddedClientHelper> m_pClientHelper;
protected:
virtual ~ODocumentDefinition();
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index a3cc1b3..3612e81 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -276,7 +276,6 @@ OApplicationController::OApplicationController(const Reference< XComponentContex
,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
,m_aTypeCollection( _rxORB )
,m_aTableCopyHelper(this)
- ,m_pClipbordNotifier(nullptr)
,m_nAsyncDrop(nullptr)
,m_aSelectContainerEvent( LINK( this, OApplicationController, OnSelectContainer ) )
,m_ePreviewMode(E_PREVIEWNONE)
@@ -341,10 +340,9 @@ void SAL_CALL OApplicationController::disposing()
if ( getView() )
{
getContainer()->showPreview(nullptr);
- m_pClipbordNotifier->ClearCallbackLink();
- m_pClipbordNotifier->RemoveListener( getView() );
- m_pClipbordNotifier->release();
- m_pClipbordNotifier = nullptr;
+ m_pClipboardNotifier->ClearCallbackLink();
+ m_pClipboardNotifier->RemoveListener( getView() );
+ m_pClipboardNotifier.clear();
}
disconnect();
@@ -446,9 +444,8 @@ bool OApplicationController::Construct(vcl::Window* _pParent)
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
m_aSystemClipboard.StartClipboardListening( );
- m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, OApplicationController, OnClipboardChanged ) );
- m_pClipbordNotifier->acquire();
- m_pClipbordNotifier->AddListener( getView() );
+ m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, OApplicationController, OnClipboardChanged ) );
+ m_pClipboardNotifier->AddListener( getView() );
OGenericUnoController::Construct( _pParent );
getView()->Show();
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index 5b9e498..dec7e2f 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -109,8 +109,8 @@ namespace dbaui
::dbaccess::ODsnTypeCollection
m_aTypeCollection;
OTableCopyHelper m_aTableCopyHelper;
- TransferableClipboardListener*
- m_pClipbordNotifier; // notifier for changes in the clipboard
+ rtl::Reference<TransferableClipboardListener>
+ m_pClipboardNotifier; // notifier for changes in the clipboard
ImplSVEvent * m_nAsyncDrop;
OAsynchronousLink m_aSelectContainerEvent;
PreviewMode m_ePreviewMode; // the mode of the preview
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 5dd5e6a..3807782 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -533,7 +533,6 @@ Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw
SbaXDataBrowserController::SbaXDataBrowserController(const Reference< css::uno::XComponentContext >& _rM)
:SbaXDataBrowserController_Base(_rM)
,m_nRowSetPrivileges(0)
- ,m_pClipbordNotifier( nullptr )
,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, OnAsyncGetCellFocus))
,m_aAsyncDisplayError( LINK( this, SbaXDataBrowserController, OnAsyncDisplayError ) )
,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD))
@@ -784,9 +783,8 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
m_aSystemClipboard.StartClipboardListening( );
- m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, SbaXDataBrowserController, OnClipboardChanged ) );
- m_pClipbordNotifier->acquire();
- m_pClipbordNotifier->AddListener( getView() );
+ m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, SbaXDataBrowserController, OnClipboardChanged ) );
+ m_pClipboardNotifier->AddListener( getView() );
// this call create the toolbox
SbaXDataBrowserController_Base::Construct(pParent);
@@ -1194,12 +1192,11 @@ void SbaXDataBrowserController::disposing()
removeModelListeners(getControlModel());
- if ( getView() && m_pClipbordNotifier )
+ if ( getView() && m_pClipboardNotifier.is() )
{
- m_pClipbordNotifier->ClearCallbackLink();
- m_pClipbordNotifier->RemoveListener( getView() );
- m_pClipbordNotifier->release();
- m_pClipbordNotifier = nullptr;
+ m_pClipboardNotifier->ClearCallbackLink();
+ m_pClipboardNotifier->RemoveListener( getView() );
+ m_pClipboardNotifier.clear();
}
if (getBrowserView())
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index d5fc7a9..5c160fb 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -93,8 +93,8 @@ namespace dbaui
AutoTimer m_aInvalidateClipboard; // for testing the state of the CUT/COPY/PASTE-slots
TransferableDataHelper m_aSystemClipboard; // content of the clipboard
- TransferableClipboardListener*
- m_pClipbordNotifier; // notifier for changes in the clipboard
+ rtl::Reference<TransferableClipboardListener>
+ m_pClipboardNotifier; // notifier for changes in the clipboard
OAsynchronousLink m_aAsyncGetCellFocus;
OAsynchronousLink m_aAsyncDisplayError;
More information about the Libreoffice-commits
mailing list