[Libreoffice-commits] core.git: forms/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 23 06:25:56 UTC 2018


 forms/source/richtext/richtextimplcontrol.cxx |    8 ++++----
 forms/source/richtext/richtextimplcontrol.hxx |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 98e991c0be88858004e535599fbb6a7bd2a23445
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 22 13:34:12 2018 +0200

    loplugin:useuniqueptr in RichTextControlImpl
    
    Change-Id: I3fcf9a4edf6dbed496bcc9160847e627777f04f1
    Reviewed-on: https://gerrit.libreoffice.org/51740
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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<ScrollBar>              m_pVScroll;
         VclPtr<ScrollBarBox>           m_pScrollCorner;
         RichTextEngine*         m_pEngine;
-        EditView*               m_pView;
+        std::unique_ptr<EditView> 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; }
 


More information about the Libreoffice-commits mailing list