Skip to content

Commit

Permalink
Fix NoSuchElementException in ReactChoreographerDispatcher.doFrame
Browse files Browse the repository at this point in the history
Summary: This diff fixes a NoSuchElementException that was being thrown at ReactChoreographerDispatcher.doFrame(). The root cause was a lack of syncronization in removeFrameCallback().

Reviewed By: shergin

Differential Revision: D14619386

fbshipit-source-id: 80bc9e44866218d2a8703b3186f6958c145f260b
  • Loading branch information
mdvacca authored and facebook-github-bot committed Mar 26, 2019
1 parent 20b4879 commit 2a336f2
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ public void run() {
public synchronized void removeFrameCallback(
CallbackType type,
ChoreographerCompat.FrameCallback frameCallback) {
if (mCallbackQueues[type.getOrder()].removeFirstOccurrence(frameCallback)) {
mTotalCallbacks--;
maybeRemoveFrameCallback();
} else {
FLog.e(ReactConstants.TAG, "Tried to remove non-existent frame callback");
synchronized (ReactChoreographer.this) {
if (mCallbackQueues[type.getOrder()].removeFirstOccurrence(frameCallback)) {
mTotalCallbacks--;
maybeRemoveFrameCallback();
} else {
FLog.e(ReactConstants.TAG, "Tried to remove non-existent frame callback");
}
}
}

Expand Down

0 comments on commit 2a336f2

Please sign in to comment.