Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(timers): cleanup task reference when exception (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsergei authored and mhevery committed Mar 7, 2017
1 parent e783bfa commit 2594940
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/common/timers.ts
Expand Up @@ -24,8 +24,11 @@ export function patchTimer(window: any, setName: string, cancelName: string, nam
function scheduleTask(task: Task) {
const data = <TimerOptions>task.data;
data.args[0] = function() {
task.invoke.apply(this, arguments);
delete tasksByHandleId[data.handleId];
try {
task.invoke.apply(this, arguments);
} finally {
delete tasksByHandleId[data.handleId];
}
};
data.handleId = setNative.apply(window, data.args);
tasksByHandleId[data.handleId] = task;
Expand Down

0 comments on commit 2594940

Please sign in to comment.