Skip to content

Commit 1cd4d7b

Browse files
fix: memory leak when activity is destroyed (#322)
1 parent 4af0c61 commit 1cd4d7b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pluto/lib/src/main/java/com/pluto/tool/modules/currentScreen/AppLifecycleListener.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ internal class AppLifecycleListener(private val screenUpdateCallback: OnCurrentS
2525
override fun onActivityStarted(activity: Activity) {}
2626
override fun onActivityStopped(activity: Activity) {}
2727
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
28-
override fun onActivityDestroyed(activity: Activity) {}
28+
override fun onActivityDestroyed(activity: Activity) {
29+
fragmentLifecycleCallbacks.activity = null
30+
}
2931
}
3032

3133
private fun Activity.registerFragmentLifecycle(callback: FragmentManager.FragmentLifecycleCallbacks) {

0 commit comments

Comments
 (0)