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

Stephan Bergmann sbergman at redhat.com
Wed Nov 23 16:12:11 UTC 2016


 sc/qa/unit/screenshots/screenshots.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit dfba3f9fb94ce18a0c0044bf21637bd0fc48fc80
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Nov 23 17:11:36 2016 +0100

    mpStream's content needs to outlive mpStream
    
    Change-Id: I70e95c540b8649ee022b26202f866b57a831b277

diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 8271561..764885d 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -53,6 +53,7 @@ private:
     ScDocShellRef                           mxDocSh;
     ScTabViewShell*                         mpViewShell;
     ScAbstractDialogFactory*                mpFact;
+    OUString                                mCsv; // needs to outlive mpStream
     std::unique_ptr<SvMemoryStream>         mpStream;
     std::unique_ptr<SfxItemSet>             mpItemSet;
 
@@ -84,6 +85,7 @@ ScScreenshotTest::ScScreenshotTest()
     mxDocSh(),
     mpViewShell(nullptr),
     mpFact(nullptr),
+    mCsv("some, strings, here, separated, by, commas"),
     mpStream(),
     mpItemSet()
 {
@@ -112,8 +114,7 @@ void ScScreenshotTest::initialize()
     mpFact = ScAbstractDialogFactory::Create();
     CPPUNIT_ASSERT_MESSAGE("Failed to create dialog factory", mpFact);
 
-    const OUString aCsv("some, strings, here, separated, by, commas");
-    SvMemoryStream* pNewMemStream = new SvMemoryStream(const_cast<sal_Unicode *>(aCsv.getStr()), aCsv.getLength() * sizeof(sal_Unicode), StreamMode::READ);
+    SvMemoryStream* pNewMemStream = new SvMemoryStream(const_cast<sal_Unicode *>(mCsv.getStr()), mCsv.getLength() * sizeof(sal_Unicode), StreamMode::READ);
     pNewMemStream->SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
     #ifdef OSL_BIGENDIAN
         pNewMemStream->SetEndian(SvStreamEndian::BIG);


More information about the Libreoffice-commits mailing list