summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-18 13:43:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-18 16:11:57 +0200
commitd5b971f94245b32e8e1a884d0076ca4f1696d09a (patch)
treefdc8f746bf0b4ac5817b488b68252a8f0e7566a3 /forms
parente149c4f3dcd08b9331dbbecf31c200d4d3bb02b5 (diff)
use rtl::Reference in forms
instead of manual reference counting Change-Id: I5bad5b7b83049f5c018a1f2d5bbc37f03727c3ce Reviewed-on: https://gerrit.libreoffice.org/43497 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/richtext/richtextcontrol.cxx16
-rw-r--r--forms/source/richtext/richtextcontrol.hxx4
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx15
-rw-r--r--forms/source/solar/component/navbarcontrol.hxx4
4 files changed, 14 insertions, 25 deletions
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index fcf1c7ee3d79..ab662fa1d078 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -180,15 +180,12 @@ namespace frm
// create the peer
Reference< XControlModel > xModel( getModel() );
- ORichTextPeer* pPeer = ORichTextPeer::Create( xModel, pParentWin, getWinBits( xModel ) );
+ rtl::Reference<ORichTextPeer> pPeer = ORichTextPeer::Create( xModel, pParentWin, getWinBits( xModel ) );
DBG_ASSERT( pPeer, "ORichTextControl::createPeer: invalid peer returned!" );
if ( pPeer )
{
- // by definition, the returned component is acquired once
- pPeer->release();
-
// announce the peer to the base class
- setPeer( pPeer );
+ setPeer( pPeer.get() );
// initialize ourself (and thus the peer) with the model properties
updateFromModel();
@@ -254,7 +251,7 @@ namespace frm
}
// ORichTextPeer
- ORichTextPeer* ORichTextPeer::Create( const Reference< XControlModel >& _rxModel, vcl::Window* _pParentWindow, WinBits _nStyle )
+ rtl::Reference<ORichTextPeer> ORichTextPeer::Create( const Reference< XControlModel >& _rxModel, vcl::Window* _pParentWindow, WinBits _nStyle )
{
DBG_TESTSOLARMUTEX();
@@ -265,14 +262,13 @@ namespace frm
return nullptr;
// the peer itself
- ORichTextPeer* pPeer = new ORichTextPeer;
- pPeer->acquire(); // by definition, the returned object is acquired once
+ rtl::Reference<ORichTextPeer> pPeer(new ORichTextPeer);
// the VCL control for the peer
- VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer );
+ VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer.get() );
// some knittings
- pRichTextControl->SetComponentInterface( pPeer );
+ pRichTextControl->SetComponentInterface( pPeer.get() );
// outta here
return pPeer;
diff --git a/forms/source/richtext/richtextcontrol.hxx b/forms/source/richtext/richtextcontrol.hxx
index e19d68b08d8e..c48fa618da62 100644
--- a/forms/source/richtext/richtextcontrol.hxx
+++ b/forms/source/richtext/richtextcontrol.hxx
@@ -86,10 +86,8 @@ namespace frm
public:
/** factory method
- @return
- a new ORichTextPeer instance, which has been acquired once!
*/
- static ORichTextPeer* Create(
+ static rtl::Reference<ORichTextPeer> Create(
const css::uno::Reference< css::awt::XControlModel >& _rxModel,
vcl::Window* _pParentWindow,
WinBits _nStyle
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index e6aca3a50d95..01b798808720 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -131,13 +131,11 @@ namespace frm
}
// create the peer
- ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( m_xContext, pParentWin, getModel() );
+ rtl::Reference<ONavigationBarPeer> pPeer = ONavigationBarPeer::Create( m_xContext, pParentWin, getModel() );
assert(pPeer && "ONavigationBarControl::createPeer: invalid peer returned!");
- // by definition, the returned component is acquired once
- pPeer->release();
// announce the peer to the base class
- setPeer( pPeer );
+ setPeer( pPeer.get() );
// initialize ourself (and thus the peer) with the model properties
updateFromModel();
@@ -198,14 +196,13 @@ namespace frm
// ONavigationBarPeer
- ONavigationBarPeer* ONavigationBarPeer::Create( const Reference< XComponentContext >& _rxORB,
+ rtl::Reference<ONavigationBarPeer> ONavigationBarPeer::Create( const Reference< XComponentContext >& _rxORB,
vcl::Window* _pParentWindow, const Reference< XControlModel >& _rxModel )
{
DBG_TESTSOLARMUTEX();
// the peer itself
- ONavigationBarPeer* pPeer = new ONavigationBarPeer( _rxORB );
- pPeer->acquire(); // by definition, the returned object is acquired once
+ rtl::Reference<ONavigationBarPeer> pPeer(new ONavigationBarPeer( _rxORB ));
// the VCL control for the peer
Reference< XModel > xContextDocument( getXModel( _rxModel ) );
@@ -220,8 +217,8 @@ namespace frm
);
// some knittings
- pNavBar->setDispatcher( pPeer );
- pNavBar->SetComponentInterface( pPeer );
+ pNavBar->setDispatcher( pPeer.get() );
+ pNavBar->SetComponentInterface( pPeer.get() );
// we want a faster repeating rate for the slots in this
// toolbox
diff --git a/forms/source/solar/component/navbarcontrol.hxx b/forms/source/solar/component/navbarcontrol.hxx
index 22ebb3046b2b..4f2463e652e5 100644
--- a/forms/source/solar/component/navbarcontrol.hxx
+++ b/forms/source/solar/component/navbarcontrol.hxx
@@ -78,10 +78,8 @@ namespace frm
{
public:
/** factory method
- @return
- a new ONavigationBarPeer instance, which has been acquired once!
*/
- static ONavigationBarPeer* Create(
+ static rtl::Reference<ONavigationBarPeer> Create(
const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
vcl::Window* _pParentWindow,
const css::uno::Reference< css::awt::XControlModel >& _rxModel