From 0a85ef61c324f18a6fd440536e12fd999111dada Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 22 Jun 2023 01:07:15 +0800 Subject: [PATCH] Call `removeMenuProvider` on `Fragment::onStop` --- app/src/main/java/com/topjohnwu/magisk/arch/BaseFragment.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/arch/BaseFragment.kt b/app/src/main/java/com/topjohnwu/magisk/arch/BaseFragment.kt index 549a1f074..f5c9b7797 100644 --- a/app/src/main/java/com/topjohnwu/magisk/arch/BaseFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/arch/BaseFragment.kt @@ -92,4 +92,10 @@ abstract class BaseFragment : Fragment(), ViewModelHo navigation?.currentDestination?.getAction(actionId)?.let { navigation!!.navigate(this) } } + override fun onStop() { + if (this is MenuProvider) { + activity?.removeMenuProvider(this) + } + super.onStop() + } }