Skip to content

Commit

Permalink
fix: avoid calling Timing.deleteTimer for setImmediate and requestIdl…
Browse files Browse the repository at this point in the history
…eCallback (#26113)

Summary:
Fix a simple error where `types[index]` was being accessed after it was cleared, instead of before.

## Changelog

[iOS] [Fixed] - never call deleteTimer for setImmediate and requestIdleCallback
Pull Request resolved: #26113

Test Plan: None

Differential Revision: D17314489

Pulled By: cpojer

fbshipit-source-id: 74715f0f7cc2d5cee3b97a67313c5e96e9d6c555
  • Loading branch information
aleclarson authored and facebook-github-bot committed Sep 11, 2019
1 parent 796b3a1 commit 4fc3e7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Core/Timers/JSTimers.js
Expand Up @@ -218,8 +218,8 @@ function _freeCallback(timerID: number) {
const index = timerIDs.indexOf(timerID);
// See corresponding comment in `callTimers` for reasoning behind this
if (index !== -1) {
_clearIndex(index);
const type = types[index];
_clearIndex(index);
if (type !== 'setImmediate' && type !== 'requestIdleCallback') {
deleteTimer(timerID);
}
Expand Down

0 comments on commit 4fc3e7a

Please sign in to comment.