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

Mike Kaganski mike.kaganski at collabora.com
Wed Jul 4 13:40:26 UTC 2018


 sw/source/uibase/dbui/dbmgr.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 67c20d4a02c55bd1749f7cdacd8a56df9c370d98
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Tue Jul 3 21:38:48 2018 +1000

    Avoid failing assert in SwDBManager::MergeMailFiles
    
    The failing assert reproducing scenario is the steps in
    https://bugs.documentfoundation.org/show_bug.cgi?id=116543#c0
    
    rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER;
    rMergeDescriptor.bPrefixIsFilename is true;
    rMergeDescriptor.sPrefix is empty.
    
    The failing assert is unrelated to the crash in tdf#116543.
    It looks like the assertion was incorrect; assert on empty
    prefix instead.
    
    Change-Id: Ibeedb90a9fac810124283fc06aa756777fa04720
    Reviewed-on: https://gerrit.libreoffice.org/56863
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 8b045595d2c3..90499f74dd59 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1153,6 +1153,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     const bool bIsMergeSilent = IsMergeSilent();
 
     bool bCheckSingleFile_ = rMergeDescriptor.bCreateSingleFile;
+    OUString sPrefix_ = rMergeDescriptor.sPrefix;
     if( bMT_EMAIL )
     {
         assert( !rMergeDescriptor.bPrefixIsFilename );
@@ -1161,11 +1162,13 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     }
     else if( bMT_SHELL || bMT_PRINTER )
     {
-        assert( !rMergeDescriptor.bPrefixIsFilename );
         assert(bCheckSingleFile_);
         bCheckSingleFile_ = true;
+        assert(sPrefix_.isEmpty());
+        sPrefix_.clear();
     }
     const bool bCreateSingleFile = bCheckSingleFile_;
+    const OUString sDescriptorPrefix = sPrefix_;
 
     // Setup for dumping debugging documents
     static const char *sMaxDumpDocs = nullptr;
@@ -1388,7 +1391,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
         // create a new temporary file name - only done once in case of bCreateSingleFile
         if( bNeedsTempFiles && ( !bWorkDocInitialized || !bCreateSingleFile ))
         {
-            OUString sPrefix = rMergeDescriptor.sPrefix;
+            OUString sPrefix = sDescriptorPrefix;
             OUString sLeading;
 
             //#i97667# if the name is from a database field then it will be used _as is_
@@ -1634,11 +1637,11 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             // save merged document
             assert( aTempFile.get() );
             INetURLObject aTempFileURL;
-            if( rMergeDescriptor.sPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename )
+            if (sDescriptorPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename)
                 aTempFileURL.SetURL( aTempFile->GetURL() );
             else
             {
-                aTempFileURL.SetURL( rMergeDescriptor.sPrefix );
+                aTempFileURL.SetURL(sDescriptorPrefix);
                 // remove the unneeded temporary file
                 aTempFile->EnableKillingFile();
             }


More information about the Libreoffice-commits mailing list