Resolves: tdf#160368 crash on save after deleting sheet
to reproduce the underlying problem: data, calc, recalculate hard: which asserts that cell I367 is dirty during parallel calc checking the dependencies for a parallel calc is supposed to find what cells it depends on and either: ensure they are not dirty or detect its not possible to do the parallel calc checking starts in J9 where:: J9: =SUM(H$8:H9)-SUM(I9:I$9) J10 =SUM(H$8:H10)-SUM(I10:I$9) for the first sum it detects that the input range is H9:H367 and checks that for dirty results, but for the second sum it detects a range of just I9 and the dirty I367 is not detected and the problem arises on calculation The code to detect the range is: // The first row that will be referenced through the doubleref. SCROW nFirstRefRow = bIsRef1RowRel ? aAbs.aStart.Row() + mnStartOffset : aAbs.aStart.Row(); // The last row that will be referenced through the doubleref. SCROW nLastRefRow = bIsRef2RowRel ? aAbs.aEnd.Row() + mnEndOffset : aAbs.aEnd.Row(); where for the I9 case has nFirstRefRow true and nLastRefRow false so we just get a range of I9:I9 instead of I9:I367. Trying to create a doc from scratch to reproduce this case proves tricky, so trim down the original document to the sheet and subset of columns that can trigger it. Change-Id: I44bfd1f6d3a3ee13db9024c5b2efa2588cc30521 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165510 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
|||||||
|
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||||
|
#*************************************************************************
|
||||||
|
#
|
||||||
|
# This file is part of the LibreOffice project.
|
||||||
|
#
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_CppunitTest,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_add_exception_objects,sc_parallelism, \
|
||||||
|
sc/qa/unit/parallelism \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_externals,sc_parallelism, \
|
||||||
|
boost_headers \
|
||||||
|
mdds_headers \
|
||||||
|
libxml2 \
|
||||||
|
$(call gb_Helper_optional,OPENCL, \
|
||||||
|
clew) \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_libraries,sc_parallelism, \
|
||||||
|
basegfx \
|
||||||
|
comphelper \
|
||||||
|
cppu \
|
||||||
|
cppuhelper \
|
||||||
|
i18nlangtag \
|
||||||
|
sal \
|
||||||
|
sax \
|
||||||
|
sc \
|
||||||
|
scqahelper \
|
||||||
|
sfx \
|
||||||
|
subsequenttest \
|
||||||
|
svl \
|
||||||
|
svx \
|
||||||
|
svxcore \
|
||||||
|
test \
|
||||||
|
tl \
|
||||||
|
unotest \
|
||||||
|
utl \
|
||||||
|
vcl \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_set_include,sc_parallelism,\
|
||||||
|
-I$(SRCDIR)/sc/source/ui/inc \
|
||||||
|
-I$(SRCDIR)/sc/inc \
|
||||||
|
$$(INCLUDE) \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_api,sc_parallelism,\
|
||||||
|
offapi \
|
||||||
|
udkapi \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_custom_headers,sc_parallelism,\
|
||||||
|
officecfg/registry \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_sdk_api,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_ure,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_vcl,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_rdb,sc_parallelism,services))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_components,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_configuration,sc_parallelism))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_add_arguments,sc_parallelism, \
|
||||||
|
-env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
|
||||||
|
))
|
||||||
|
|
||||||
|
# vim: set noet sw=4 ts=4:
|
||||||
@@ -62,6 +62,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
|
|||||||
CppunitTest_sc_core \
|
CppunitTest_sc_core \
|
||||||
CppunitTest_sc_dataprovider \
|
CppunitTest_sc_dataprovider \
|
||||||
CppunitTest_sc_cache_test \
|
CppunitTest_sc_cache_test \
|
||||||
|
CppunitTest_sc_parallelism \
|
||||||
CppunitTest_sc_shapetest \
|
CppunitTest_sc_shapetest \
|
||||||
))
|
))
|
||||||
endif
|
endif
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,88 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sal/config.h>
|
||||||
|
|
||||||
|
#include "helper/qahelper.hxx"
|
||||||
|
|
||||||
|
#include <document.hxx>
|
||||||
|
#include <formulagroup.hxx>
|
||||||
|
|
||||||
|
#include <officecfg/Office/Calc.hxx>
|
||||||
|
|
||||||
|
using namespace sc;
|
||||||
|
|
||||||
|
// test-suite suitable for loading documents to test parallelism in
|
||||||
|
// with access only to exported symbols
|
||||||
|
|
||||||
|
class ScParallelismTest : public ScModelTestBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScParallelismTest()
|
||||||
|
: ScModelTestBase("sc/qa/unit/data")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void setUp() override;
|
||||||
|
virtual void tearDown() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool getThreadingFlag() const;
|
||||||
|
void setThreadingFlag(bool bSet);
|
||||||
|
|
||||||
|
bool m_bThreadingFlagCfg;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ScParallelismTest::getThreadingFlag() const
|
||||||
|
{
|
||||||
|
return officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::
|
||||||
|
get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScParallelismTest::setThreadingFlag(bool bSet)
|
||||||
|
{
|
||||||
|
std::shared_ptr<comphelper::ConfigurationChanges> xBatch(
|
||||||
|
comphelper::ConfigurationChanges::create());
|
||||||
|
officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::set(
|
||||||
|
bSet, xBatch);
|
||||||
|
xBatch->commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScParallelismTest::setUp()
|
||||||
|
{
|
||||||
|
ScModelTestBase::setUp();
|
||||||
|
|
||||||
|
sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly();
|
||||||
|
|
||||||
|
m_bThreadingFlagCfg = getThreadingFlag();
|
||||||
|
if (!m_bThreadingFlagCfg)
|
||||||
|
setThreadingFlag(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScParallelismTest::tearDown()
|
||||||
|
{
|
||||||
|
// Restore threading flag
|
||||||
|
if (!m_bThreadingFlagCfg)
|
||||||
|
setThreadingFlag(false);
|
||||||
|
|
||||||
|
ScModelTestBase::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dependency range in this document was detected as I9:I9 instead of expected I9:I367
|
||||||
|
CPPUNIT_TEST_FIXTURE(ScParallelismTest, testTdf160368)
|
||||||
|
{
|
||||||
|
createScDoc("ods/tdf160368.ods");
|
||||||
|
ScDocShell* pDocSh = getScDocShell();
|
||||||
|
// without fix: ScFormulaCell::MaybeInterpret(): Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.
|
||||||
|
pDocSh->DoHardRecalc();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||||
@@ -16,6 +16,9 @@
|
|||||||
using namespace css;
|
using namespace css;
|
||||||
using namespace css::uno;
|
using namespace css::uno;
|
||||||
|
|
||||||
|
// test-suite suitable for creating documents to test parallelism in
|
||||||
|
// with access to internal unexported symbols
|
||||||
|
|
||||||
class ScParallelismTest : public ScUcalcTestBase
|
class ScParallelismTest : public ScUcalcTestBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -4606,10 +4606,17 @@ struct ScDependantsCalculator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCROW nFirstRefStartRow = bIsRef1RowRel ? aAbs.aStart.Row() + mnStartOffset : aAbs.aStart.Row();
|
||||||
|
SCROW nLastRefEndRow = bIsRef2RowRel ? aAbs.aEnd.Row() + mnEndOffset : aAbs.aEnd.Row();
|
||||||
|
|
||||||
|
SCROW nFirstRefEndRow = bIsRef1RowRel ? aAbs.aStart.Row() + mnEndOffset : aAbs.aStart.Row();
|
||||||
|
SCROW nLastRefStartRow = bIsRef2RowRel ? aAbs.aEnd.Row() + mnStartOffset : aAbs.aEnd.Row();
|
||||||
|
|
||||||
// The first row that will be referenced through the doubleref.
|
// The first row that will be referenced through the doubleref.
|
||||||
SCROW nFirstRefRow = bIsRef1RowRel ? aAbs.aStart.Row() + mnStartOffset : aAbs.aStart.Row();
|
SCROW nFirstRefRow = std::min(nFirstRefStartRow, nLastRefStartRow);
|
||||||
// The last row that will be referenced through the doubleref.
|
// The last row that will be referenced through the doubleref.
|
||||||
SCROW nLastRefRow = bIsRef2RowRel ? aAbs.aEnd.Row() + mnEndOffset : aAbs.aEnd.Row();
|
SCROW nLastRefRow = std::max(nLastRefEndRow, nFirstRefEndRow);
|
||||||
|
|
||||||
// Number of rows to be evaluated from nFirstRefRow.
|
// Number of rows to be evaluated from nFirstRefRow.
|
||||||
SCROW nArrayLength = nLastRefRow - nFirstRefRow + 1;
|
SCROW nArrayLength = nLastRefRow - nFirstRefRow + 1;
|
||||||
assert(nArrayLength > 0);
|
assert(nArrayLength > 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user