[apps/calculation] Reset history cell memoization when reloading the

table. Otherwise, the Poincare pool store useless layouts for cells that
aren't displayed.

This fixes the following issue: input "(transpose([1 2 3 4 5 6][1 2 3 4 5
6])^8", the computation works, clear the history, input the same
calculation again, it fails with a memory error.
This commit is contained in:
Émilie Feral
2020-02-19 10:10:35 +01:00
committed by LeaNumworks
parent f6d59ae184
commit 2a03583fe0
3 changed files with 17 additions and 3 deletions

View File

@@ -24,6 +24,13 @@ HistoryController::HistoryController(EditExpressionController * editExpressionCo
}
void HistoryController::reload() {
/* When reloading, we might not used anymore cell that hold previous layouts.
* We clean them all before reloading their content to avoid taking extra
* useless space in the Poincare pool. */
for (int i = 0; i < k_maxNumberOfDisplayedRows; i++) {
m_calculationHistory[i].resetMemoization();
}
m_selectableTableView.reloadData();
/* TODO
* Replace the following by selectCellAtLocation in order to avoid laying out