[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source

Eike Rathke erack at redhat.com
Wed Mar 9 16:19:16 UTC 2016


 sc/source/core/tool/interpr4.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 070fbda4edafb27c91c856039880099014f2b53f
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Mar 9 16:18:55 2016 +0100

    Resolves: tdf#95226 second case, stack error count in JumpMatrix context
    
    For the early bail out on errors to work correctly and not prematurely
    end calculations the current error function needs to be stacked in
    JumpMatrix context, otherwise we may end up with
    ((nErrorFunction=74)>=(nErrorFunctionCount=2)) or some such..
    
    (cherry picked from commit 62b40429946c0e5021912072dc79a60fc11fce06)
    
    Change-Id: I3559e15180694961585db92f6aa98a46430ae372
    Reviewed-on: https://gerrit.libreoffice.org/23091
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 44e25c7..6ed55dd 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -75,6 +75,7 @@
 #include <vbahelper/vbaaccesshelper.hxx>
 #include <memory>
 #include <boost/scoped_array.hpp>
+#include <stack>
 
 using namespace com::sun::star;
 using namespace formula;
@@ -3564,6 +3565,7 @@ StackVar ScInterpreter::Interpret()
     sal_uLong nRetIndexExpr = 0;
     sal_uInt16 nErrorFunction = 0;
     sal_uInt16 nErrorFunctionCount = 0;
+    std::stack<sal_uInt16> aErrorFunctionStack;
     sal_uInt16 nStackBase;
 
     nGlobalError = 0;
@@ -4094,7 +4096,19 @@ StackVar ScInterpreter::Interpret()
             else
                 nLevel = 0;
             if ( nLevel == 1 || (nLevel == 2 && aCode.IsEndOfPath()) )
+            {
+                if (nLevel == 1)
+                    aErrorFunctionStack.push( nErrorFunction);
                 bGotResult = JumpMatrix( nLevel );
+                if (aErrorFunctionStack.empty())
+                    assert(!"ScInterpreter::Interpret - aErrorFunctionStack empty in JumpMatrix context");
+                else
+                {
+                    nErrorFunction = aErrorFunctionStack.top();
+                    if (bGotResult)
+                        aErrorFunctionStack.pop();
+                }
+            }
             else
                 pJumpMatrix = NULL;
         } while ( bGotResult );


More information about the Libreoffice-commits mailing list