sw/source/filter/ascii/parasc.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit aed2fbd28e54913ae6de13f0f68a7c60d6d6568f
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Aug 8 19:06:36 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 12 08:04:43 2022 +0200

    no need to allocate this on heap
    
    Change-Id: I0a95d901d8f0b8660ad2dddf38a47b57dedc432e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138150
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/filter/ascii/parasc.cxx 
b/sw/source/filter/ascii/parasc.cxx
index 9d2be5e85000..0b05173369ff 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -86,17 +86,18 @@ ErrCode AsciiReader::Read( SwDoc& rDoc, const OUString&, 
SwPaM &rPam, const OUSt
         return ERR_SWG_READ_ERROR;
     }
 
-    std::unique_ptr<SwASCIIParser> xParser(new SwASCIIParser( rDoc, rPam, 
*m_pStream,
-                                        !m_bInsertMode, 
m_aOption.GetASCIIOpts() ));
-    ErrCode nRet = xParser->CallParser();
-
-    OUString optionsString;
-    xParser->GetUsedAsciiOptions().WriteUserData(optionsString);
+    ErrCode nRet;
+    {
+        SwASCIIParser aParser( rDoc, rPam, *m_pStream,
+                                !m_bInsertMode, m_aOption.GetASCIIOpts() );
+        nRet = aParser.CallParser();
 
-    if(m_pMedium != nullptr && m_pMedium->GetItemSet() != nullptr)
-        m_pMedium->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
optionsString));
+        OUString optionsString;
+        aParser.GetUsedAsciiOptions().WriteUserData(optionsString);
 
-    xParser.reset();
+        if(m_pMedium != nullptr && m_pMedium->GetItemSet() != nullptr)
+            m_pMedium->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
optionsString));
+    }
     // after Read reset the options
     m_aOption.ResetASCIIOpts();
     return nRet;

Reply via email to