diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-02-25 15:45:43 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-03-01 10:03:05 +0100 |
commit | b5c3f38cb8d4121e3303be362e0757d3d3431059 (patch) | |
tree | 92131dad7dcaf1c5b526b4ee4007f2c5699d8028 /sc/source | |
parent | bbd3145f72c4abfbf17dd09d9cb2724f04416450 (diff) |
do not call GetFormatTable() from GetNonThreadedContext() (tdf#121949)
ScDocument dtor calls ClearLookupCaches(), which calls GetNonThreadedContext().
But ScDocument instances used for copy&paste GetFormatTable() fails
on null mxPoolHelper, because ScDocument ctor doesn't set it in such a case.
So set up the pointer in ScInterpreterContext on demand only if actually
needed.
Change-Id: If3811da5bb00a2d7d404c089ee1bf46037a2cddb
Reviewed-on: https://gerrit.libreoffice.org/68350
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/table3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpretercontext.cxx | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 055c55fc14ba..4e9f074470ae 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2360,7 +2360,7 @@ public: { sal_uInt32 nNumFmt = pContext ? mrTab.GetNumberFormat(*pContext, ScAddress(nCol, nRow, mrTab.GetTab())) : mrTab.GetNumberFormat(nCol, nRow); - SvNumberFormatter* pFormatter = pContext ? pContext->mpFormatter : mrDoc.GetFormatTable(); + SvNumberFormatter* pFormatter = pContext ? pContext->GetFormatTable() : mrDoc.GetFormatTable(); const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt); if (pEntry) { @@ -2434,7 +2434,7 @@ public: sal_uInt32 nFormat = pContext ? mrTab.GetNumberFormat( *pContext, ScAddress(static_cast<SCCOL>(rEntry.nField), nRow, mrTab.GetTab()) ) : mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow ); OUString aStr; - SvNumberFormatter* pFormatter = pContext ? pContext->mpFormatter : mrDoc.GetFormatTable(); + SvNumberFormatter* pFormatter = pContext ? pContext->GetFormatTable() : mrDoc.GetFormatTable(); ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, &mrDoc); return compareByStringComparator(rEntry, rItem, nullptr, &aStr); } diff --git a/sc/source/core/tool/interpretercontext.cxx b/sc/source/core/tool/interpretercontext.cxx index bc67afca039c..b997effe13c4 100644 --- a/sc/source/core/tool/interpretercontext.cxx +++ b/sc/source/core/tool/interpretercontext.cxx @@ -18,6 +18,8 @@ */ #include <interpretercontext.hxx> + +#include <document.hxx> #include <formula/token.hxx> #include <lookupcache.hxx> #include <algorithm> @@ -47,6 +49,11 @@ void ScInterpreterContext::SetDocAndFormatter(const ScDocument& rDoc, SvNumberFo mpFormatter = pFormatter; } +void ScInterpreterContext::initFormatTable() +{ + mpFormatter = mpDoc->GetFormatTable(); // will assert if not main thread +} + void ScInterpreterContext::Cleanup() { // Do not disturb mScLookupCache |