sw/inc/viewsh.hxx | 15 ++++++++------- sw/source/core/view/vnew.cxx | 9 ++++----- 2 files changed, 12 insertions(+), 12 deletions(-)
New commits: commit e00f99a1157f0ed31210ed1a662457d184ec4819 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 16 14:32:06 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 17 08:39:52 2018 +0200 loplugin:useuniqueptr in SwViewShell Change-Id: I2060769860be8527f7966d2d83fe9a6f533f8271 Reviewed-on: https://gerrit.libreoffice.org/57520 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 832f4f9dd878..484fbe951f95 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -107,7 +107,8 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell> SwRect maInvalidRect; SfxViewShell *mpSfxViewShell; - SwViewShellImp *mpImp; // Core-internals of SwViewShell. + std::unique_ptr<SwViewShellImp> + mpImp; // Core-internals of SwViewShell. // The pointer is never 0. VclPtr<vcl::Window> mpWin; ///< = 0 during printing or pdf export @@ -118,8 +119,8 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell> // (because a scaling has to be set at // the original printer) - SwViewOption *mpOpt; - SwAccessibilityOptions* mpAccOptions; + std::unique_ptr<SwViewOption> mpOpt; + std::unique_ptr<SwAccessibilityOptions> mpAccOptions; bool mbDocSizeChgd :1; // For DocChgNotify(): Announce new DocSize // at EndAction to DocMDI. @@ -183,8 +184,8 @@ protected: public: - SwViewShellImp *Imp() { return mpImp; } - const SwViewShellImp *Imp() const { return mpImp; } + SwViewShellImp *Imp() { return mpImp.get(); } + const SwViewShellImp *Imp() const { return mpImp.get(); } const SwNodes& GetNodes() const; @@ -417,7 +418,7 @@ public: // Calls Idle-formatter of Layout. void LayoutIdle(); - const SwViewOption *GetViewOptions() const { return mpOpt; } + const SwViewOption *GetViewOptions() const { return mpOpt.get(); } virtual void ApplyViewOptions( const SwViewOption &rOpt ); void SetUIOptions( const SwViewOption &rOpt ); virtual void SetReadonlyOption(bool bSet); // Set readonly-bit of ViewOptions. @@ -425,7 +426,7 @@ public: void SetPrtFormatOption(bool bSet); // Set PrtFormat-Bit of ViewOptions. void SetReadonlySelectionOption(bool bSet); // Change the selection mode in readonly docs. - const SwAccessibilityOptions* GetAccessibilityOptions() const { return mpAccOptions;} + const SwAccessibilityOptions* GetAccessibilityOptions() const { return mpAccOptions.get();} static void SetShellRes( ShellResource* pRes ) { mpShellRes = pRes; } static ShellResource* GetShellRes(); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 4c74acecdd09..f8ef50bcc65a 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -54,7 +54,7 @@ void SwViewShell::Init( const SwViewOption *pNewOpt ) if( !mpOpt ) { - mpOpt = new SwViewOption; + mpOpt.reset(new SwViewOption); // ApplyViewOptions() does not need to be called if( pNewOpt ) @@ -319,8 +319,7 @@ SwViewShell::~SwViewShell() GetDoc()->StopNumRuleAnimations( mpOut ); } - delete mpImp; // Delete first, so that the LayoutViews are destroyed. - mpImp = nullptr; // Set to zero, because ~SwFrame relies on it. + mpImp.reset(); if ( mxDoc.get() ) { @@ -328,7 +327,7 @@ SwViewShell::~SwViewShell() GetLayout()->ResetNewLayout(); } - delete mpOpt; + mpOpt.reset(); // resize format cache. if ( SwTextFrame::GetTextCache()->GetCurMax() > 250 ) @@ -358,7 +357,7 @@ SwViewShell::~SwViewShell() } mpTmpRef.disposeAndClear(); - delete mpAccOptions; + mpAccOptions.reset(); } bool SwViewShell::HasDrawView() const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits