[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 30 13:19:11 UTC 2019


 sc/source/ui/miscdlgs/acredlin.cxx |   45 +++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 17 deletions(-)

New commits:
commit 80c1d52946d3d60721f7d76e537caa722a5ca5a6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Apr 23 11:06:20 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Apr 30 15:18:16 2019 +0200

    multiple concatted AcceptChgDat stored in config
    
    FillInfo is called more often than Initialize, so we've ended up
    with multiple AcceptChgDat strings
    
    Change-Id: I99e9398757d63e2c6315ec9c3101910d5978b13b
    Reviewed-on: https://gerrit.libreoffice.org/71120
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index b1294a0ddff6..3349eee8e910 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -1714,34 +1714,43 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
     }
 }
 
-void ScAcceptChgDlg::Initialize(SfxChildWinInfo *pInfo)
+namespace
 {
-    OUString aStr;
-    if(pInfo!=nullptr)
+    //at one point we were writing multiple AcceptChgDat strings,
+    //so strip all of them and keep the results of the last one
+    OUString lcl_StripAcceptChgDat(OUString &rExtraString)
     {
-        if ( !pInfo->aExtraString.isEmpty() )
+        OUString aStr;
+        while (true)
         {
-            sal_Int32 nPos = pInfo->aExtraString.indexOf("AcceptChgDat:");
-
+            sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
+            if (nPos == -1)
+                break;
             // Try to read the alignment string "ALIGN:(...)"; if it is missing
             // we have an old version
-            if ( nPos != -1 )
+            sal_Int32 n1 = rExtraString.indexOf('(', nPos);
+            if ( n1 != -1 )
             {
-                sal_Int32 n1 = pInfo->aExtraString.indexOf('(', nPos);
-                if ( n1 != -1 )
+                sal_Int32 n2 = rExtraString.indexOf(')', n1);
+                if ( n2 != -1 )
                 {
-                    sal_Int32 n2 = pInfo->aExtraString.indexOf(')', n1);
-                    if ( n2 != -1 )
-                    {
-                        // cut out alignment string
-                        aStr = pInfo->aExtraString.copy(nPos, n2 - nPos + 1);
-                        pInfo->aExtraString = pInfo->aExtraString.replaceAt(nPos, n2 - nPos + 1, "");
-                        aStr = aStr.copy( n1-nPos+1 );
-                    }
+                    // cut out alignment string
+                    aStr = rExtraString.copy(nPos, n2 - nPos + 1);
+                    rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, "");
+                    aStr = aStr.copy( n1-nPos+1 );
                 }
             }
         }
+        return aStr;
     }
+}
+
+void ScAcceptChgDlg::Initialize(SfxChildWinInfo *pInfo)
+{
+    OUString aStr;
+    if (pInfo && !pInfo->aExtraString.isEmpty())
+        aStr = lcl_StripAcceptChgDat(pInfo->aExtraString);
+
     SfxModelessDialog::Initialize(pInfo);
 
     if ( !aStr.isEmpty())
@@ -1760,6 +1769,8 @@ void ScAcceptChgDlg::Initialize(SfxChildWinInfo *pInfo)
 void ScAcceptChgDlg::FillInfo(SfxChildWinInfo& rInfo) const
 {
     SfxModelessDialog::FillInfo(rInfo);
+    //remove any old one before adding a new one
+    lcl_StripAcceptChgDat(rInfo.aExtraString);
     rInfo.aExtraString += "AcceptChgDat:(";
 
     sal_uInt16  nCount=pTheView->TabCount();


More information about the Libreoffice-commits mailing list