From e040894fbe0765883e13d51fd6d6331adb09832c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 6 Jul 2018 19:25:13 +0200 Subject: tdf#118554 sc crash clicking outside of comments regression from commit c7f762973d21118ce3f5b0baab8850dc89bc4765 loplugin:useuniqueptr in ScTabView Change-Id: If7fd580f1a2fedbc6b707f59f196cbceffc95fe3 Reviewed-on: https://gerrit.libreoffice.org/57090 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sc/source/ui/view/tabview5.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sc/source/ui/view/tabview5.cxx') diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 6900ce9fc430..962fc20e5c9f 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -131,6 +131,7 @@ void ScTabView::Init() // UpdateShow is done during resize or a copy of an existing view from ctor pDrawActual = nullptr; + pDrawOld = nullptr; // DrawView cannot be create in the TabView - ctor // when the ViewShell isn't constructed yet... @@ -158,7 +159,10 @@ ScTabView::~ScTabView() pPageBreakData.reset(); - pDrawActual.reset(); + delete pDrawActual; + pDrawActual = nullptr; + delete pDrawOld; + pDrawOld = nullptr; if (comphelper::LibreOfficeKit::isActive()) { @@ -246,7 +250,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) // so that immediately can be drawn } SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool()); - SetDrawFuncPtr(o3tl::make_unique(*aViewData.GetViewShell(), GetActiveWin(), pDrawView, + SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView, pLayer,aSfxRequest)); // used when switching back from page preview: restore saved design mode state @@ -684,11 +688,4 @@ void ScTabView::OnLOKNoteStateChanged(const ScPostIt* pNote) } } -void ScTabView::SetDrawFuncPtr(std::unique_ptr pNew) -{ - if (pDrawActual) - pDrawActual->Deactivate(); - pDrawActual = std::move(pNew); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit