diff options
-rw-r--r-- | include/svx/svdpntv.hxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 13 |
2 files changed, 8 insertions, 10 deletions
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 2405ad9ca4b5..dc20ac774300 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -34,6 +34,7 @@ #include <svtools/optionsdrawinglayer.hxx> #include <unotools/options.hxx> #include <vcl/idle.hxx> +#include <memory> // Pre defines @@ -133,7 +134,7 @@ private: // the SdrModel this view was created with, unchanged during lifetime SdrModel& mrSdrModelFromSdrView; - SdrPageView* mpPageView; + std::unique_ptr<SdrPageView> mpPageView; protected: SdrModel* mpModel; #ifdef DBG_UTIL @@ -313,7 +314,7 @@ public: virtual void HideSdrPage(); // Iterate over all registered PageViews - SdrPageView* GetSdrPageView() const { return mpPageView; } + SdrPageView* GetSdrPageView() const { return mpPageView.get(); } // A SdrView can be displayed on multiple Windows at the same time virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index ba0e252da346..f83f7fc9052b 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -185,7 +185,6 @@ SdrPaintView::SdrPaintView( SdrModel& rSdrModel, OutputDevice* pOut) : mrSdrModelFromSdrView(rSdrModel), - mpPageView(nullptr), maDefaultAttr(rSdrModel.GetItemPool()), mbBufferedOutputAllowed(false), mbBufferedOverlayAllowed(false), @@ -394,8 +393,7 @@ void SdrPaintView::ClearPageView() if(mpPageView) { InvalidateAllWin(); - delete mpPageView; - mpPageView = nullptr; + mpPageView.reset(); } } @@ -406,14 +404,14 @@ SdrPageView* SdrPaintView::ShowSdrPage(SdrPage* pPage) if(mpPageView) { InvalidateAllWin(); - delete mpPageView; + mpPageView.reset(); } - mpPageView = new SdrPageView(pPage, *static_cast<SdrView*>(this)); + mpPageView.reset(new SdrPageView(pPage, *static_cast<SdrView*>(this))); mpPageView->Show(); } - return mpPageView; + return mpPageView.get(); } void SdrPaintView::HideSdrPage() @@ -421,8 +419,7 @@ void SdrPaintView::HideSdrPage() if(mpPageView) { mpPageView->Hide(); - delete mpPageView; - mpPageView = nullptr; + mpPageView.reset(); } } |