From f9201922446574a4afc5b12ea47ddffef62a2710 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 18 Apr 2017 08:22:29 +1200 Subject: [PATCH] Fix up script tear-down --- scripts/system/record.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/system/record.js b/scripts/system/record.js index 80a90cf165..20d69cc35a 100644 --- a/scripts/system/record.js +++ b/scripts/system/record.js @@ -598,7 +598,9 @@ text: APP_NAME, isActive: false }); - button.clicked.connect(onButtonClicked); + if (button) { + button.clicked.connect(onButtonClicked); + } // Track showing/hiding tablet/dialog. tablet.screenChanged.connect(onTabletScreenChanged); @@ -625,7 +627,11 @@ tablet.tabletShownChanged.disconnect(onTabletShownChanged); tablet.screenChanged.disconnect(onTabletScreenChanged); - button.clicked.disconnect(onButtonClicked); + if (button) { + button.clicked.disconnect(onButtonClicked); + tablet.removeButton(button); + button = null; + } if (Recorder.isCountingDown()) { Recorder.cancelCountdown(); @@ -637,7 +643,7 @@ tablet.gotoHomeScreen(); } - tablet.removeButton(button); + tablet = null; } // FIXME: If setUp() is run immediately at Interface start-up, Interface hangs and crashes because of the line of code: