clear mCurrentActivity in onHostDestroy

Summary: It doesn't make sense to clear mCurrentActivity in onHostPause -- we're not going to leak a paused activity. Only keeping it around after onDestroy could lead to leaks. This allows us to check the source of lifecycle events and only send them if they come from the current activity (upcoming diff).

Reviewed By: astreet

Differential Revision: D3655370

fbshipit-source-id: f54b04a95c5c090636219832e63a348f3ae5a5c3
This commit is contained in:
Felix Oghina 2016-08-08 09:01:15 -07:00 committed by Facebook Github Bot 1
parent baf5a5b99a
commit 46dc46a3b3
2 changed files with 1 additions and 2 deletions

View File

@ -487,7 +487,6 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
}
moveToBeforeResumeLifecycleState();
mCurrentActivity = null;
}
/**

View File

@ -178,7 +178,6 @@ public class ReactContext extends ContextWrapper {
for (LifecycleEventListener listener : mLifecycleEventListeners) {
listener.onHostPause();
}
mCurrentActivity = null;
}
/**
@ -189,6 +188,7 @@ public class ReactContext extends ContextWrapper {
for (LifecycleEventListener listener : mLifecycleEventListeners) {
listener.onHostDestroy();
}
mCurrentActivity = null;
}
/**