check if listener is still in the set before calling onHostResume
Reviewed By: achen1 Differential Revision: D6341419 fbshipit-source-id: e49188803bbf3641bad6a9cc8c497d453798bbce
This commit is contained in:
parent
231c7a0304
commit
ad89ea7b50
|
@ -141,16 +141,20 @@ public class ReactContext extends ContextWrapper {
|
|||
case BEFORE_RESUME:
|
||||
break;
|
||||
case RESUMED:
|
||||
runOnUiQueueThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
listener.onHostResume();
|
||||
} catch (RuntimeException e) {
|
||||
handleException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
runOnUiQueueThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!mLifecycleEventListeners.contains(listener)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
listener.onHostResume();
|
||||
} catch (RuntimeException e) {
|
||||
handleException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unhandled lifecycle state.");
|
||||
|
|
Loading…
Reference in New Issue