summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-06-01 00:18:46 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2019-06-01 04:07:39 +0200
commit7e5554ca2e1f37168444592de623f5214194b537 (patch)
tree887bae81dae461fd9a29241bd2281bca1bd8e79b
parentae5b453eb63d08f8aba471d8263bff84be80c8aa (diff)
Resolves: tdf#101473 handle volatile Add-In results without formula cell
... while temporarily interpreting from within the Function Wizard. Change-Id: I88e7e062989ed395accd50ed9bfe1b76b3b297ea Reviewed-on: https://gerrit.libreoffice.org/73290 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 7272b9f752cb74757d6ed504202eefccc589f804) Reviewed-on: https://gerrit.libreoffice.org/73300 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sc/source/core/tool/interpr4.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 57ab5aec29a2..0610e32994d3 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3025,12 +3025,21 @@ void ScInterpreter::ScExternal()
rArr.AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT );
uno::Reference<sheet::XVolatileResult> xRes = aCall.GetVarRes();
ScAddInListener* pLis = ScAddInListener::Get( xRes );
+ // In case there is no pMyFormulaCell, i.e. while interpreting
+ // temporarily from within the Function Wizard, try to obtain a
+ // valid result from an existing listener for that volatile, or
+ // create a new and hope for an immediate result. If none
+ // available that should lead to a void result and thus #N/A.
+ bool bTemporaryListener = false;
if ( !pLis )
{
pLis = ScAddInListener::CreateListener( xRes, pDok );
- pMyFormulaCell->StartListening( *pLis );
+ if (pMyFormulaCell)
+ pMyFormulaCell->StartListening( *pLis );
+ else
+ bTemporaryListener = true;
}
- else
+ else if (pMyFormulaCell)
{
pMyFormulaCell->StartListening( *pLis );
if ( !pLis->HasDocument( pDok ) )
@@ -3040,6 +3049,20 @@ void ScInterpreter::ScExternal()
}
aCall.SetResult( pLis->GetResult() ); // use result from async
+
+ if (bTemporaryListener)
+ {
+ try
+ {
+ // EventObject can be any, not evaluated by
+ // ScAddInListener::disposing()
+ css::lang::EventObject aEvent;
+ pLis->disposing(aEvent); // pLis is dead hereafter
+ }
+ catch (const uno::Exception&)
+ {
+ }
+ }
}
if ( aCall.GetErrCode() != FormulaError::NONE )