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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 14 14:30:24 UTC 2021


 vcl/qa/cppunit/GraphicTest.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit beb9932893b7c4f0b442f807361e1d411511ab51
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jun 14 14:22:16 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jun 14 16:29:40 2021 +0200

    stack-use-after-scope
    
    (Graphic::GetGfxLink returns a temporary GfxLink object---whose lifetime thus
    ends at the end of the full expression---and GfxLink::getDataContainer returns a
    reference into that temporary object---which thus became dangling at the end of
    the full expression.)
    
    Change-Id: I1b84088a74c8c9efb5502f3b3917252858c01557
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117159
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index e9af574aa5a4..44ad1df12829 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -480,9 +480,8 @@ void GraphicTest::testWMFWithEmfPlusRoundtrip()
         CPPUNIT_ASSERT_EQUAL(0, getPolygonActionsCount(aNewGraphic));
 
         // With EMF+ disabled there should be no EMF+ actions.
-        auto& rDataContainer = aNewGraphic.GetGfxLink().getDataContainer();
-        auto aVectorGraphicData
-            = std::make_shared<VectorGraphicData>(rDataContainer, VectorGraphicDataType::Wmf);
+        auto aVectorGraphicData = std::make_shared<VectorGraphicData>(
+            aNewGraphic.GetGfxLink().getDataContainer(), VectorGraphicDataType::Wmf);
         aVectorGraphicData->setEnableEMFPlus(false);
         Graphic aNoEmfPlusGraphic(aVectorGraphicData);
         CPPUNIT_ASSERT_EQUAL(0, getEmfPlusActionsCount(aNoEmfPlusGraphic));


More information about the Libreoffice-commits mailing list