Kaydet (Commit) d5b971f9 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in forms

instead of manual reference counting

Change-Id: I5bad5b7b83049f5c018a1f2d5bbc37f03727c3ce
Reviewed-on: https://gerrit.libreoffice.org/43497Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e149c4f3
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment