Skip to content

Commit 286d36b

Browse files
author
Douglas Machado
authored
fix(android): FragmentCallbacksImplementation memory leak (#9977)
1 parent 59f9235 commit 286d36b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/core/ui/frame/index.android.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,9 +1031,14 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
10311031
// animation should start between start and resume, so if we have an executing navigation here it probably means the animation was skipped
10321032
// so we manually set the entry
10331033
// also, to be compatible with fragments 1.2.x we need this setTimeout as animations haven't run on onResume yet
1034+
const weakRef = new WeakRef(this);
10341035
setTimeout(() => {
1035-
if (frame._executingContext && !(<any>this.entry).isAnimationRunning) {
1036-
frame.setCurrent(this.entry, frame._executingContext.navigationType);
1036+
const owner = weakRef.get();
1037+
if (!owner) {
1038+
return;
1039+
}
1040+
if (frame._executingContext && !(<any>owner.entry).isAnimationRunning) {
1041+
frame.setCurrent(owner.entry, frame._executingContext.navigationType);
10371042
}
10381043
}, 0);
10391044

0 commit comments

Comments
 (0)