[apps/apps_container] Add timer to circuit breaker

poincareCircuitBreaker requires the Back key to be pressed for at least
50 ms before interrupting a computation.
This is effectively invisible for the user, but fixes a bug in
Calculation :
  - When leaving the additional results for a result using units by
    pressing the Back key, a reduction preceding a call to removeUnits
    would be interrupted, causing an undefined behaviour.

Change-Id: Iec667ae964f190de2171850cc22e1726959e6cb5
This commit is contained in:
Gabriel Ozouf
2020-08-13 13:22:39 +02:00
committed by Émilie Feral
parent df6383d2d8
commit 504223612d
2 changed files with 16 additions and 4 deletions

View File

@@ -254,9 +254,6 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
}
if (o.hasUnit()) {
Expression unit;
/* FIXME : When this method is accessed via leaving the additional outputs,
* ie via a press on BACK, the reduction is interrupted, and removeUnit
* goes badly.*/
PoincareHelpers::Reduce(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User, ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined, ExpressionNode::UnitConversion::None);
o = o.removeUnit(&unit);
double value = PoincareHelpers::ApproximateToScalar<double>(o, App::app()->localContext());