summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-27 13:52:36 +0100
committerAndras Timar <andras.timar@collabora.com>2015-06-18 11:19:45 +0200
commite336e2d2e521bd0758a927d82756c0437a7b9c82 (patch)
tree16b1396ea331752399b5214a7a948c739f3317fa /sc
parent1616a4f6ed76f6527879a52ad389d5d9f24e2b4c (diff)
Resolves: tdf#91416 setting progress -> resize -> destroy formula context
i.e. setting progress triggers ScTabView::DoResize and an InterpretVisible and InterpretDirtyCells which resets the mpFormulaGroupCxt that the current rCxt points to, which is bad, so disable progress for the duration of the GetResult loop Change-Id: I8e88cee4dd2308ef61dee934d300a38978833703 (cherry picked from commit e3c1a394a00cef416a81b89b6d5c204891abb286) Reviewed-on: https://gerrit.libreoffice.org/15926 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/progress.hxx4
-rw-r--r--sc/source/core/data/column2.cxx17
-rw-r--r--sc/source/core/data/formulacell.cxx8
-rw-r--r--sc/source/core/tool/progress.cxx13
4 files changed, 35 insertions, 7 deletions
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index a658829612a2..e14561df06ae 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -49,6 +49,7 @@ private:
static bool bAllowInterpretProgress;
static ScDocument* pInterpretDoc;
static bool bIdleWasEnabled;
+ bool bEnabled;
SfxProgress* pProgress;
@@ -144,6 +145,9 @@ public:
return pProgress->GetState();
return 0;
}
+ bool Enabled() const { return bEnabled; }
+ void Disable() { bEnabled = false; }
+ void Enable() { bEnabled = true; }
};
#endif
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 0f22f7974a03..6f764c7d57fb 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -43,6 +43,7 @@
#include "formulagroup.hxx"
#include "listenercontext.hxx"
#include "mtvcellfunc.hxx"
+#include "progress.hxx"
#include "scmatrix.hxx"
#include <rowheightcontext.hxx>
@@ -2305,10 +2306,23 @@ bool appendToBlock(
sc::formula_block::iterator itData, itDataEnd;
getBlockIterators<sc::formula_block>(it, nLenRemain, itData, itDataEnd);
+ /* tdf#91416 setting progress in triggers a resize of the window
+ and so ScTabView::DoResize and an InterpretVisible and
+ InterpretDirtyCells which resets the mpFormulaGroupCxt that
+ the current rCxt points to, which is bad, so disable progress
+ during GetResult
+ */
+ ScProgress *pProgress = ScProgress::GetInterpretProgress();
+ bool bTempDisableProgress = pProgress && pProgress->Enabled();
+ if (bTempDisableProgress)
+ pProgress->Disable();
+
for (; itData != itDataEnd; ++itData, ++nPos)
{
ScFormulaCell& rFC = **itData;
+
sc::FormulaResultValue aRes = rFC.GetResult();
+
if (aRes.meType == sc::FormulaResultValue::Invalid || aRes.mnError)
{
if (aRes.mnError == ScErrorCodes::errCircularReference)
@@ -2331,6 +2345,9 @@ bool appendToBlock(
(*rColArray.mpNumArray)[nPos] = aRes.mfValue;
}
}
+
+ if (bTempDisableProgress)
+ pProgress->Enable();
}
break;
case sc::element_type_empty:
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 044c4a37b0f6..efa393a04c99 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1937,8 +1937,12 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
}
// Reschedule slows the whole thing down considerably, thus only execute on percent change
- ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
+ ScProgress *pProgress = ScProgress::GetInterpretProgress();
+ if (pProgress && pProgress->Enabled())
+ {
+ pProgress->SetStateCountDownOnPercent(
+ pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
+ }
switch (p->GetVolatileType())
{
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index c0e4a291f143..a416fcab1208 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -70,8 +70,9 @@ static bool lcl_HasControllersLocked( SfxObjectShell& rObjSh )
return false;
}
-ScProgress::ScProgress( SfxObjectShell* pObjSh, const OUString& rText,
- sal_uLong nRange, bool bAllDocs, bool bWait )
+ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText,
+ sal_uLong nRange, bool bAllDocs, bool bWait)
+ : bEnabled(true)
{
if ( pGlobalProgress || SfxProgress::GetActiveProgress( NULL ) )
@@ -114,9 +115,11 @@ ScProgress::ScProgress( SfxObjectShell* pObjSh, const OUString& rText,
}
}
-ScProgress::ScProgress() :
- pProgress( NULL )
-{ // DummyInterpret
+ScProgress::ScProgress()
+ : bEnabled(true)
+ , pProgress(NULL)
+{
+ // DummyInterpret
}
ScProgress::~ScProgress()