[ fixup ] Clear timeout after removing listeners for safety

pull/3692/head
Denis Buzdalov 2024-12-11 13:29:54 +03:00
parent 8b9bccdd10
commit 4c1bcbbb4d
2 changed files with 4 additions and 3 deletions

View File

@ -6,4 +6,4 @@
add settings for widgets, order of drawing and hour hand length
0.06: Fix issue showing widgets when app is fast-loaded into from launcher with widgets disabled
0.07: Enable fast loading and queue updates to the second
0.08: Restore redraw on charging event
0.08: Restore redraw on charging event + fixup for safer fast-loading

View File

@ -135,11 +135,12 @@ let drawScale = function() {
Bangle.setUI({
mode: "clock",
remove: function() {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
Bangle.removeListener('lcdPower', updateState);
Bangle.removeListener('lock', updateState);
Bangle.removeListener('charging', draw);
// We clear drawTimout after removing all listeners, because they can add one again
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
require("widget_utils").show();
}
});