From 7d7a5666aea903ad69276a4d65b0df2768d473b8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 19 Jan 2017 13:58:56 +0200 Subject: [PATCH] use rtl::Reference in FormControlContainer instead of manual acquire/release Change-Id: Ie0fed7db217adea68aaa09cf9de699d488bf84dd --- .../source/bibliography/formcontrolcontainer.cxx | 11 ++++------- .../source/bibliography/formcontrolcontainer.hxx | 5 +++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx index f0dfe3b77741..4da38e35780b 100644 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ b/extensions/source/bibliography/formcontrolcontainer.cxx @@ -35,7 +35,6 @@ namespace bib FormControlContainer::FormControlContainer( ) :OLoadListener( m_aMutex ) - ,m_pFormAdapter( nullptr ) { } @@ -52,9 +51,8 @@ namespace bib SAL_WARN_IF( !isFormConnected(), "extensions.biblio", "FormControlContainer::connectForm: not connected!" ); if ( isFormConnected() ) { - m_pFormAdapter->dispose(); - m_pFormAdapter->release(); - m_pFormAdapter = nullptr; + m_xFormAdapter->dispose(); + m_xFormAdapter.clear(); } } @@ -65,9 +63,8 @@ namespace bib SAL_WARN_IF( !_rxForm.is(), "extensions.biblio", "FormControlContainer::connectForm: invalid form!" ); if ( !isFormConnected() && _rxForm.is() ) { - m_pFormAdapter = new OLoadListenerAdapter( _rxForm ); - m_pFormAdapter->acquire(); - m_pFormAdapter->Init( this ); + m_xFormAdapter = new OLoadListenerAdapter( _rxForm ); + m_xFormAdapter->Init( this ); implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() ); } diff --git a/extensions/source/bibliography/formcontrolcontainer.hxx b/extensions/source/bibliography/formcontrolcontainer.hxx index a75a528a7c5e..78673eb0fd1d 100644 --- a/extensions/source/bibliography/formcontrolcontainer.hxx +++ b/extensions/source/bibliography/formcontrolcontainer.hxx @@ -23,6 +23,7 @@ #include #include "loadlisteneradapter.hxx" #include +#include namespace bib @@ -33,7 +34,7 @@ namespace bib ,public ::bib::OLoadListener { private: - OLoadListenerAdapter* m_pFormAdapter; + rtl::Reference m_xFormAdapter; css::uno::Reference< css::form::XLoadable > m_xForm; private: void implSetDesignMode( bool _bDesign ); @@ -42,7 +43,7 @@ namespace bib FormControlContainer( ); virtual ~FormControlContainer( ) override; - bool isFormConnected() const { return nullptr != m_pFormAdapter; } + bool isFormConnected() const { return m_xFormAdapter.is(); } void connectForm( const css::uno::Reference< css::form::XLoadable >& _rxForm ); void disconnectForm();