From eea56488e696e3122fb9cc2b0c25577868814981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 7 Nov 2018 16:40:55 +0100 Subject: [PATCH] [apps] Fix VarBoxController::viewDidDisappear parent method call order Before, we tidied the memoization before calling the parent's viewDidDisappear method. As the parent method needed some cell heights, it used the VarBoxController memoization, thus re-creating layouts that would stay in the pool after closing the app. Scenario: Go in the Graph app, create f(x) = 1, empty g(x) and h(x), create p(x) and while editing go in the variable box controller, all the way down, then hit the Home button. --- apps/variable_box_controller.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/variable_box_controller.cpp b/apps/variable_box_controller.cpp index 1effc023c..b3db3c1a0 100644 --- a/apps/variable_box_controller.cpp +++ b/apps/variable_box_controller.cpp @@ -32,13 +32,20 @@ void VariableBoxController::viewDidDisappear() { if (isDisplayingEmptyController()) { pop(); } - // Tidy the layouts used to display the VariableBoxController to clean TreePool + + NestedMenuController::viewDidDisappear(); + + /* NestedMenuController::viewDidDisappear might need cell heights, which would + * use the VariableBoxController cell heights memoization. We thus reset the + * VariableBoxController layouts only after calling the parent's + * viewDidDisappear. */ + + // Tidy the layouts displayed in the VariableBoxController to clean TreePool for (int i = 0; i < k_maxNumberOfDisplayedRows; i++) { m_leafCells[i].setLayout(Layout()); m_leafCells[i].setAccessoryLayout(Layout()); } resetMemoization(); - NestedMenuController::viewDidDisappear(); } bool VariableBoxController::handleEvent(Ion::Events::Event event) {