summaryrefslogtreecommitdiff
path: root/forms/source/richtext
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/source/richtext
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/source/richtext')
-rw-r--r--forms/source/richtext/richtextcontrol.cxx16
-rw-r--r--forms/source/richtext/richtextcontrol.hxx4
2 files changed, 7 insertions, 13 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