Skip to content

Commit

Permalink
fix(ui): ui callbacks still alive after script exit
Browse files Browse the repository at this point in the history
  • Loading branch information
hyb1996 committed Apr 1, 2018
1 parent b3f000d commit e312977
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@ public boolean hasPendingCallbacks() {
return mMaxCallbackUptimeMillis > SystemClock.uptimeMillis();
}

public void removeAllCallbacks() {
mHandler.removeCallbacksAndMessages(null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ public void onExit() {
ignoresException(images::releaseScreenCapturer);
}
ignoresException(sensors::unregisterAll);
ignoresException(timers::recycle);
}

private void ignoresException(Runnable r) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,8 @@ public boolean hasPendingCallbacks() {
return getTimerForCurrentThread().hasPendingCallbacks();
}

public void recycle(){
mMainTimer.removeAllCallbacks();
}

}

0 comments on commit e312977

Please sign in to comment.