File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
app/src/main/java/com/duckduckgo/app/browser Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ import kotlin.coroutines.CoroutineContext
5656class BrowserActivity : DuckDuckGoActivity (), CoroutineScope {
5757
5858 override val coroutineContext: CoroutineContext
59- get() = SupervisorJob () + Dispatchers .Main
59+ get() = job + Dispatchers .Main
6060
6161 @Inject
6262 lateinit var clearPersonalDataAction: ClearPersonalDataAction
@@ -70,6 +70,8 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
7070 @Inject
7171 lateinit var playStoreUtils: PlayStoreUtils
7272
73+ private val job = SupervisorJob ()
74+
7375 private var currentTab: BrowserTabFragment ? = null
7476
7577 private val viewModel: BrowserViewModel by bindViewModel()
@@ -101,6 +103,16 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
101103 viewModel.awaitClearDataFinishedNotification()
102104 }
103105
106+ override fun onStop () {
107+ job.cancel()
108+ super .onStop()
109+ }
110+
111+ override fun onDestroy () {
112+ currentTab = null
113+ super .onDestroy()
114+ }
115+
104116 override fun onNewIntent (intent : Intent ? ) {
105117 super .onNewIntent(intent)
106118 Timber .i(" onNewIntent: $intent " )
You can’t perform that action at this time.
0 commit comments