From 98e991c0be88858004e535599fbb6a7bd2a23445 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 22 Mar 2018 13:34:12 +0200 Subject: loplugin:useuniqueptr in RichTextControlImpl Change-Id: I3fcf9a4edf6dbed496bcc9160847e627777f04f1 Reviewed-on: https://gerrit.libreoffice.org/51740 Tested-by: Jenkins Reviewed-by: Noel Grandin --- forms/source/richtext/richtextimplcontrol.cxx | 8 ++++---- forms/source/richtext/richtextimplcontrol.hxx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'forms') diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index ed3cce56bc2c..9059870ebdd5 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -65,8 +65,8 @@ namespace frm m_pAntiImpl->SetMapMode( aRefDeviceMapMode ); m_pViewport->SetMapMode( aRefDeviceMapMode ); - m_pView = new EditView( m_pEngine, m_pViewport ); - m_pEngine->InsertView( m_pView ); + m_pView.reset(new EditView( m_pEngine, m_pViewport )); + m_pEngine->InsertView( m_pView.get() ); m_pViewport->setView( *m_pView ); m_pEngine->registerEngineStatusListener( this ); @@ -88,9 +88,9 @@ namespace frm RichTextControlImpl::~RichTextControlImpl( ) { - m_pEngine->RemoveView( m_pView ); + m_pEngine->RemoveView( m_pView.get() ); m_pEngine->revokeEngineStatusListener( this ); - delete m_pView; + m_pView.reset(); m_pViewport.disposeAndClear(); m_pHScroll.disposeAndClear(); m_pVScroll.disposeAndClear(); diff --git a/forms/source/richtext/richtextimplcontrol.hxx b/forms/source/richtext/richtextimplcontrol.hxx index 89ea51463286..cac441a1ed83 100644 --- a/forms/source/richtext/richtextimplcontrol.hxx +++ b/forms/source/richtext/richtextimplcontrol.hxx @@ -58,14 +58,14 @@ namespace frm VclPtr m_pVScroll; VclPtr m_pScrollCorner; RichTextEngine* m_pEngine; - EditView* m_pView; + std::unique_ptr m_pView; ITextAttributeListener* m_pTextAttrListener; ITextSelectionListener* m_pSelectionListener; bool m_bHasEverBeenShown; public: struct GrantAccess { friend class RichTextControl; private: GrantAccess() { } }; - EditView* getView( const GrantAccess& ) const { return m_pView; } + EditView* getView( const GrantAccess& ) const { return m_pView.get(); } RichTextEngine* getEngine( const GrantAccess& ) const { return m_pEngine; } vcl::Window* getViewport( const GrantAccess& ) const { return m_pViewport; } -- cgit