diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-24 11:06:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-25 08:46:07 +0200 |
commit | f154ed6d9c5ba1895ec07f0d93337f6941803e59 (patch) | |
tree | f9fb67c8bf307f4d59da47da8583ebf88f5604c7 /sw | |
parent | 3426b8ea0ded6423e465bf1770433b39cc345ffd (diff) |
loplugin:useuniqueptr in SwSrcEditWindow
Change-Id: I64d8a4ab60df95672363df7a4ac65cf4d2f9c8c2
Reviewed-on: https://gerrit.libreoffice.org/57939
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/inc/srcedtw.hxx | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index a625f02bd999..f38d0b287546 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -292,12 +292,10 @@ void SwSrcEditWindow::dispose() if ( m_pTextEngine ) { EndListening( *m_pTextEngine ); - m_pTextEngine->RemoveView( m_pTextView ); + m_pTextEngine->RemoveView( m_pTextView.get() ); - delete m_pTextView; - m_pTextView = nullptr; - delete m_pTextEngine; - m_pTextEngine = nullptr; + m_pTextView.reset(); + m_pTextEngine.reset(); } m_pHScrollbar.disposeAndClear(); m_pVScrollbar.disposeAndClear(); @@ -518,13 +516,13 @@ void SwSrcEditWindow::CreateTextEngine() m_pHScrollbar->EnableDrag(); m_pVScrollbar->Show(); - m_pTextEngine = new ExtTextEngine; - m_pTextView = new TextView( m_pTextEngine, m_pOutWin ); + m_pTextEngine.reset(new ExtTextEngine); + m_pTextView.reset(new TextView( m_pTextEngine.get(), m_pOutWin )); m_pTextView->SetAutoIndentMode(true); - m_pOutWin->SetTextView(m_pTextView); + m_pOutWin->SetTextView(m_pTextView.get()); m_pTextEngine->SetUpdateMode( false ); - m_pTextEngine->InsertView( m_pTextView ); + m_pTextEngine->InsertView( m_pTextView.get() ); vcl::Font aFont; aFont.SetTransparent( false ); diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index ef9f90a096f8..beb43502c158 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -64,8 +64,8 @@ class SwSrcEditWindow : public vcl::Window, public SfxListener private: class ChangesListener; friend class ChangesListener; - TextView* m_pTextView; - ExtTextEngine* m_pTextEngine; + std::unique_ptr<TextView> m_pTextView; + std::unique_ptr<ExtTextEngine> m_pTextEngine; VclPtr<TextViewOutWin> m_pOutWin; VclPtr<ScrollBar> m_pHScrollbar, @@ -121,9 +121,9 @@ public: void Write(SvStream& rOutput) { m_pTextEngine->Write(rOutput); } TextView* GetTextView() - {return m_pTextView;} + {return m_pTextView.get();} TextEngine* GetTextEngine() - {return m_pTextEngine;} + {return m_pTextEngine.get();} SwSrcView* GetSrcView() {return m_pSrcView;} TextViewOutWin* GetOutWin() {return m_pOutWin;} |