summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-04-01 23:51:46 +0200
committerEike Rathke <erack@redhat.com>2021-04-02 00:48:46 +0200
commit465b8b0e9ad4b0c9c7701dee2820a99c5d00b5bf (patch)
treeec364f54ee7cf5c5bfd923d8b0c03a2f8053996f /sc
parentb2b892ddb13cd21c031519a6f6ca8d496deaf259 (diff)
Work around assert() in circular reference within group calc, tdf#141146
Triggered by crash test loading document of wget 'https://bz.apache.org/ooo/attachment.cgi?id=71756' -O ooo114587-1.ods after commit 042dbf83122b14fd1dd32705c8f8b7d65c22f21b CommitDate: Thu Mar 25 16:31:29 2021 +0100 Resolves: tdf#141146 Fix LOOKUP in array with result scalar / single reference Though could happen any time whenever a shared formula group calc attempts to obtain a result from an already running cell. Change-Id: Id668b31a8d81389c593c6fd2191fd444efcdb70f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113494 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/formulacell.hxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index ae889d7ba77b..28317d60690a 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -22,11 +22,13 @@
#include <memory>
#include <formula/tokenarray.hxx>
+#include <formula/errorcodes.hxx>
#include <svl/listener.hxx>
#include "types.hxx"
#include "interpretercontext.hxx"
#include "document.hxx"
+#include "docoptio.hxx"
#include "formulalogger.hxx"
#include "formularesult.hxx"
@@ -436,15 +438,25 @@ public:
return (rDocument.GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE));
}
- bool MaybeInterpret()
+ void MaybeInterpret()
{
if (NeedsInterpret())
{
- assert(!rDocument.IsThreadedGroupCalcInProgress());
- Interpret();
- return true;
+ if (bRunning && !rDocument.GetDocOptions().IsIter() && rDocument.IsThreadedGroupCalcInProgress())
+ {
+ // This is actually copied from Interpret()'s if(bRunning)
+ // block that once caught this circular reference but now is
+ // prepended with various threaded group calc things which the
+ // assert() below is supposed to fail on when entering again.
+ // Nevertheless, we need some state here the caller can obtain.
+ aResult.SetResultError( FormulaError::CircularReference );
+ }
+ else
+ {
+ assert(!rDocument.IsThreadedGroupCalcInProgress());
+ Interpret();
+ }
}
- return false;
}
/**