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

fix(timers): cleanup task reference when exception #637

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/common/timers.ts
Original file line number Diff line number Diff line change
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