Skip to content

Commit

Permalink
[ fixup ] Clear timeout after removing listeners for safety
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Dec 11, 2024
1 parent 8b9bccd commit 4c1bcbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/andark/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions apps/andark/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
Expand Down

0 comments on commit 4c1bcbb

Please sign in to comment.