summaryrefslogtreecommitdiff
path: root/svx/source/form
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-02 14:53:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-06 07:01:51 +0000
commit7d1b01070c330d45212cd69ea692b2263c23c2a6 (patch)
tree7ae6ecdd69cd3d8b6ce4431a39034186695497c0 /svx/source/form
parent9f138ffe9da2f448a455f4b51facab82e5e243d7 (diff)
remove some manual ref counting in svx and xmloff
Change-Id: Ica0b6ff8ff7fa9e65cd758160d6e3ea7110ebb46 Reviewed-on: https://gerrit.libreoffice.org/25824 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx/source/form')
-rw-r--r--svx/source/form/filtnav.cxx7
-rw-r--r--svx/source/form/fmshell.cxx3
-rw-r--r--svx/source/form/fmsrcimp.cxx4
-rw-r--r--svx/source/form/fmtools.cxx15
-rw-r--r--svx/source/form/fmview.cxx8
-rw-r--r--svx/source/form/formcontroller.cxx40
-rw-r--r--svx/source/form/formcontrolling.cxx8
-rw-r--r--svx/source/form/navigatortreemodel.cxx16
-rw-r--r--svx/source/form/tabwin.cxx11
9 files changed, 34 insertions, 78 deletions
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index d6f9d201f665..7c1f1ee9924d 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -490,7 +490,6 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& Event )
FmFilterModel::FmFilterModel()
:FmParentData(nullptr, OUString())
,OSQLParserClient(comphelper::getProcessComponentContext())
- ,m_pAdapter(nullptr)
,m_pCurrentItems(nullptr)
{
}
@@ -509,11 +508,10 @@ void FmFilterModel::Clear()
Broadcast( aClearedHint );
// lose endings
- if (m_pAdapter)
+ if (m_pAdapter.is())
{
m_pAdapter->dispose();
- m_pAdapter->release();
- m_pAdapter= nullptr;
+ m_pAdapter.clear();
}
m_pCurrentItems = nullptr;
@@ -551,7 +549,6 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, const
// Listening for TextChanges
m_pAdapter = new FmFilterAdapter(this, xControllers);
- m_pAdapter->acquire();
SetCurrentController(xCurrent);
EnsureEmptyFilterRows( *this );
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 7eb32e2fd976..e710f0f931a0 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -211,7 +211,6 @@ FmFormShell::FmFormShell( SfxViewShell* _pParent, FmFormView* pView )
,m_bDesignMode( true )
,m_bHasForms(false)
{
- m_pImpl->acquire();
SetPool( &SfxGetpApp()->GetPool() );
SetName( "Form" );
@@ -225,8 +224,6 @@ FmFormShell::~FmFormShell()
SetView( nullptr );
m_pImpl->dispose();
- m_pImpl->release();
- m_pImpl = nullptr;
}
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index 2e6ab8ed47a1..914872bf484a 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -217,14 +217,12 @@ bool FmSearchEngine::MoveCursor()
else
if (m_xSearchCursor.isFirst())
{
- FmRecordCountListener* prclListener = new FmRecordCountListener(m_xSearchCursor);
- prclListener->acquire();
+ rtl::Reference<FmRecordCountListener> prclListener = new FmRecordCountListener(m_xSearchCursor);
prclListener->SetPropChangeHandler(LINK(this, FmSearchEngine, OnNewRecordCount));
m_xSearchCursor.last();
prclListener->DisConnect();
- prclListener->release();
}
else
m_xSearchCursor.previous();
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index bfd316e5a94e..4eb8d38fc2c7 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -283,19 +283,8 @@ FmXDisposeListener::~FmXDisposeListener()
void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter)
{
- if (m_pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter->release();
- m_pAdapter = nullptr;
- }
-
- if (pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter = pAdapter;
- m_pAdapter->acquire();
- }
+ ::osl::MutexGuard aGuard(m_rMutex);
+ m_pAdapter = pAdapter;
}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 7762f8bed226..f40e773cda69 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -90,8 +90,6 @@ void FmFormView::Init()
{
pFormShell = nullptr;
pImpl = new FmXFormView(this);
- pImpl->acquire();
-
// Model setzen
SdrModel* pModel = GetModel();
@@ -138,8 +136,6 @@ FmFormView::~FmFormView()
pFormShell->SetView( nullptr );
pImpl->notifyViewDying();
- pImpl->release();
- pImpl = nullptr;
}
@@ -163,7 +159,7 @@ void FmFormView::MarkListHasChanged()
pImpl->m_pMarkedGrid = nullptr;
if ( pImpl->m_xWindow.is() )
{
- pImpl->m_xWindow->removeFocusListener(pImpl);
+ pImpl->m_xWindow->removeFocusListener(pImpl.get());
pImpl->m_xWindow = nullptr;
}
SetMoveOutside(false);
@@ -500,7 +496,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
pImpl->m_pMarkedGrid = pObj;
pImpl->m_xWindow = xWindow;
// add as listener to get notified when ESC will be pressed inside the grid
- pImpl->m_xWindow->addFocusListener(pImpl);
+ pImpl->m_xWindow->addFocusListener(pImpl.get());
SetMoveOutside(true);
//OLMRefreshAllIAOManagers();
xWindow->setFocus();
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 20602fdcd128..1ace5b93fe11 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -4165,21 +4165,17 @@ Reference< XDispatchProviderInterceptor > FormController::createInterceptor(con
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
#ifdef DBG_UTIL
// check if we already have a interceptor for the given object
- for ( Interceptors::const_iterator aIter = m_aControlDispatchInterceptors.begin();
- aIter != m_aControlDispatchInterceptors.end();
- ++aIter
- )
+ for ( const auto & it : m_aControlDispatchInterceptors )
{
- if ((*aIter)->getIntercepted() == _xInterception)
+ if (it->getIntercepted() == _xInterception)
OSL_FAIL("FormController::createInterceptor : we already do intercept this objects dispatches !");
}
#endif
- DispatchInterceptionMultiplexer* pInterceptor = new DispatchInterceptionMultiplexer( _xInterception, this );
- pInterceptor->acquire();
- m_aControlDispatchInterceptors.insert( m_aControlDispatchInterceptors.end(), pInterceptor );
+ rtl::Reference<DispatchInterceptionMultiplexer> pInterceptor(new DispatchInterceptionMultiplexer( _xInterception, this ));
+ m_aControlDispatchInterceptors.push_back( pInterceptor );
- return pInterceptor;
+ return pInterceptor.get();
}
@@ -4208,28 +4204,20 @@ void FormController::deleteInterceptor(const Reference< XDispatchProviderInterce
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
// search the interceptor responsible for the given object
- Interceptors::const_iterator aEnd = m_aControlDispatchInterceptors.end();
- Interceptors::iterator aIter;
- for ( aIter = m_aControlDispatchInterceptors.begin();
+ const auto aEnd = m_aControlDispatchInterceptors.end();
+ for ( auto aIter = m_aControlDispatchInterceptors.begin();
aIter != aEnd;
++aIter
)
{
- if ((*aIter)->getIntercepted() == _xInterception)
- break;
- }
- if (aIter == aEnd)
- {
- return;
+ if ((*aIter)->getIntercepted() == _xInterception) {
+ // log off the interception from its interception object
+ (*aIter)->dispose();
+ // remove the interceptor from our array
+ m_aControlDispatchInterceptors.erase(aIter);
+ return;
+ }
}
-
- // log off the interception from its interception object
- DispatchInterceptionMultiplexer* pInterceptorImpl = *aIter;
- pInterceptorImpl->dispose();
- pInterceptorImpl->release();
-
- // remove the interceptor from our array
- m_aControlDispatchInterceptors.erase(aIter);
}
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index 8255ccc5dfd3..06172a19821e 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -190,14 +190,12 @@ namespace svx
ControllerFeatures::ControllerFeatures( IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( nullptr )
{
}
ControllerFeatures::ControllerFeatures( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( nullptr )
{
assign( _rxController );
}
@@ -207,7 +205,6 @@ namespace svx
{
dispose();
m_pImpl = new FormControllerHelper( _rxController, m_pInvalidationCallback );
- m_pImpl->acquire();
}
@@ -219,11 +216,10 @@ namespace svx
void ControllerFeatures::dispose()
{
- if ( m_pImpl )
+ if ( m_pImpl.is() )
{
m_pImpl->dispose();
- m_pImpl->release();
- m_pImpl = nullptr;
+ m_pImpl.clear();
}
}
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index ada3cf9a33f8..fbfbeb6bd8f4 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -193,7 +193,6 @@ namespace svxform
,m_aNormalImages( _rNormalImages )
{
m_pPropChangeList = new OFormComponentObserver(this);
- m_pPropChangeList->acquire();
m_pRootList = new FmEntryDataList();
}
@@ -215,7 +214,6 @@ namespace svxform
Clear();
delete m_pRootList;
m_pPropChangeList->ReleaseModel();
- m_pPropChangeList->release();
}
@@ -232,7 +230,7 @@ namespace svxform
{
Reference< css::form::XForms > xForms( GetForms());
if(xForms.is())
- xForms->removeContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xForms->removeContainerListener(m_pPropChangeList.get());
// delete RootList
@@ -325,7 +323,7 @@ namespace svxform
// register as PropertyChangeListener
Reference< XPropertySet > xSet(xElement, UNO_QUERY);
if( xSet.is() )
- xSet->addPropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+ xSet->addPropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get() );
// Remove data from model
@@ -333,7 +331,7 @@ namespace svxform
{
Reference< XContainer > xContainer(xElement, UNO_QUERY);
if (xContainer.is())
- xContainer->addContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xContainer->addContainerListener(m_pPropChangeList.get());
}
if (pFolder)
@@ -466,11 +464,11 @@ namespace svxform
// unregister as PropertyChangeListener
Reference< XPropertySet > xSet( pFormData->GetPropertySet() );
if ( xSet.is() )
- xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get() );
Reference< XContainer > xContainer( pFormData->GetContainer() );
if (xContainer.is())
- xContainer->removeContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xContainer->removeContainerListener(m_pPropChangeList.get());
}
@@ -485,7 +483,7 @@ namespace svxform
// unregister as PropertyChangeListener
Reference< XPropertySet > xSet( pControlData->GetPropertySet() );
if (xSet.is())
- xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList);
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get());
}
@@ -835,7 +833,7 @@ namespace svxform
Clear();
if (xForms.is())
{
- xForms->addContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xForms->addContainerListener(m_pPropChangeList.get());
FillBranch(nullptr);
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index c9adc54a864c..e9b06b34a04c 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -172,7 +172,6 @@ FmFieldWin::FmFieldWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Wind
,SfxControllerItem(SID_FM_FIELDS_CONTROL, *_pBindings)
,::comphelper::OPropertyChangeListener(m_aMutex)
,m_nObjectType(0)
- ,m_pChangeListener(nullptr)
{
SetHelpId( HID_FIELD_SEL_WIN );
@@ -191,11 +190,10 @@ FmFieldWin::~FmFieldWin()
void FmFieldWin::dispose()
{
- if (m_pChangeListener)
+ if (m_pChangeListener.is())
{
m_pChangeListener->dispose();
- m_pChangeListener->release();
- // delete m_pChangeListener;
+ m_pChangeListener.clear();
}
pListBox.disposeAndClear();
::SfxControllerItem::dispose();
@@ -358,13 +356,12 @@ void FmFieldWin::UpdateContent(const css::uno::Reference< css::form::XForm > & x
}
// listen for changes at ControlSource in PropertySet
- if (m_pChangeListener)
+ if (m_pChangeListener.is())
{
m_pChangeListener->dispose();
- m_pChangeListener->release();
+ m_pChangeListener.clear();
}
m_pChangeListener = new ::comphelper::OPropertyChangeMultiplexer(this, xSet);
- m_pChangeListener->acquire();
m_pChangeListener->addProperty(FM_PROP_DATASOURCE);
m_pChangeListener->addProperty(FM_PROP_COMMAND);
m_pChangeListener->addProperty(FM_PROP_COMMANDTYPE);