aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-01-01 17:21:26 -0500
committerAllan Wang <me@allanwang.ca>2019-01-01 17:21:26 -0500
commit8245f835b6e5711b3363851ef70e156ae001bda3 (patch)
tree587ce07744b2d0549156ba1c2e894f9e2c3eeb0c /app/src/main/kotlin
parent91de05ef93c592cd3da9311a60e14751eef27750 (diff)
downloadfrost-8245f835b6e5711b3363851ef70e156ae001bda3.tar.gz
frost-8245f835b6e5711b3363851ef70e156ae001bda3.tar.bz2
frost-8245f835b6e5711b3363851ef70e156ae001bda3.zip
Close channels after destroy, resolves #1292
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt2
3 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
index 13253bcf..0f3a1e52 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -485,10 +485,10 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
override fun onDestroy() {
- fragmentChannel.close()
- headerBadgeChannel.close()
controlWebview?.destroy()
super.onDestroy()
+ fragmentChannel.close()
+ headerBadgeChannel.close()
}
override fun collapseAppBar() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
index 9a0c6270..230c1a55 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
@@ -66,7 +66,11 @@ class MainActivity : BaseMainActivity() {
}
}
})
- viewPager.post { fragmentChannel.offer(0); lastPosition = 0 } //trigger hook so title is set
+ viewPager.post {
+ if (!fragmentChannel.isClosedForSend)
+ fragmentChannel.offer(0)
+ lastPosition = 0
+ } //trigger hook so title is set
}
private fun setupTabs() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
index ea549026..0000195c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
@@ -209,11 +209,11 @@ abstract class BaseFragment : Fragment(), CoroutineScope, FragmentContract, Dyna
}
override fun onDestroyView() {
+ super.onDestroyView()
L.i { "Fragment on destroy $position ${hashCode()}" }
content?.destroy()
content = null
detachMainObservable()
- super.onDestroyView()
}
override fun onDestroy() {