[Libreoffice-commits] core.git: sw/qa

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 21 18:43:56 UTC 2021


 sw/qa/core/macros-test.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 318c48205cf598ee6c2312e5b4d0ae7fc1ee6c36
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 21 15:23:51 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 21 20:43:15 2021 +0200

    fix SwDoc leaks in CppunitTest_sw_macros_test
    
    Change-Id: I488c722fcba553f8784a1b14d841128cbda77934
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115924
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 66f2dd9b2794..91c7a928a46a 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -132,7 +132,7 @@ void SwMacrosTest::testVba()
 
 void SwMacrosTest::testBookmarkDeleteAndJoin()
 {
-    SwDoc *const pDoc = new SwDoc;
+    rtl::Reference<SwDoc> const pDoc(new SwDoc);
     pDoc->GetIDocumentUndoRedo().DoUndo(true); // bug is in SwUndoDelete
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
     SwPaM aPaM(aIdx);
@@ -172,7 +172,7 @@ void SwMacrosTest::testBookmarkDeleteAndJoin()
 
 void SwMacrosTest::testBookmarkDeleteTdf90816()
 {
-    SwDoc *const pDoc = new SwDoc;
+    rtl::Reference<SwDoc> const pDoc(new SwDoc);
     pDoc->GetIDocumentUndoRedo().DoUndo(true); // bug is in SwUndoDelete
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
     SwPaM aPaM(aIdx);
@@ -309,7 +309,7 @@ void SwMacrosTest::testControlShapeGrouping()
 
 void SwMacrosTest::testFdo55289()
 {
-    SwDoc *const pDoc = new SwDoc;
+    SwDoc* const pDoc = new SwDoc;
     SwDocShellRef pDocShell = new SwDocShell(*pDoc, SfxObjectCreateMode::EMBEDDED);
     // this needs to run with no layout to tickle the bugs in the special
     // cases in SwXShape re-anchoring
@@ -337,6 +337,7 @@ void SwMacrosTest::testFdo55289()
         uno::Reference<text::XTextDocument>(xModel, UNO_QUERY_THROW)->getText()->getEnd();
     uno::Reference<text::XTextContent> const xShapeContent(xShape, UNO_QUERY);
     xShapeContent->attach(xEnd);
+    pDocShell->DoClose();
 }
 
 void SwMacrosTest::testFdo68983()


More information about the Libreoffice-commits mailing list