From ca5e875958882ed54b376535cccc144e3fa0345f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 12 Aug 2020 10:35:01 +0200 Subject: expand out DELETEZ Change-Id: I8691d7cedc340997284b1e8e9adae5f867c2d707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100586 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../AccessibleDocumentPagePreview.cxx | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index ddbc8ecb5ab1..d7a9ebb5845a 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -125,23 +125,20 @@ ScNotesChildren::ScNotesChildren(ScPreviewShell* pViewShell, ScAccessibleDocumen { } -namespace { - -struct DeleteAccNote -{ - void operator()(ScAccNote& rNote) - { - if (rNote.mpTextHelper) - DELETEZ( rNote.mpTextHelper); - } -}; - -} - ScNotesChildren::~ScNotesChildren() { - std::for_each(maNotes.begin(), maNotes.end(), DeleteAccNote()); - std::for_each(maMarks.begin(), maMarks.end(), DeleteAccNote()); + for (auto & i : maNotes) + if (i.mpTextHelper) + { + delete i.mpTextHelper; + i.mpTextHelper = nullptr; + } + for (auto & i : maMarks) + if (i.mpTextHelper) + { + delete i.mpTextHelper; + i.mpTextHelper = nullptr; + } } ::accessibility::AccessibleTextHelper* ScNotesChildren::CreateTextHelper(const OUString& rString, const tools::Rectangle& rVisRect, const ScAddress& aCellPos, bool bMarkNote, sal_Int32 nChildOffset) const @@ -386,7 +383,8 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData, aNote.mnParaCount = aNote.mpTextHelper->GetChildCount(); // collect removed children CollectChildren(*aItr, rOldParas); - DELETEZ(aItr->mpTextHelper); + delete aItr->mpTextHelper; + aItr->mpTextHelper = nullptr;; // collect new children CollectChildren(aNote, rNewParas); } @@ -408,7 +406,8 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData, { // collect removed children CollectChildren(*aItr, rOldParas); - DELETEZ(aItr->mpTextHelper); + delete aItr->mpTextHelper; + aItr->mpTextHelper = nullptr; // no note to add // not necessary, because this branch should not be reached if it is the end -- cgit