kirillrakhman
03/20/2017, 8:28 AMuse style code but don't want additional allocations.elizarov
03/20/2017, 8:30 AMkirillrakhman
03/20/2017, 8:31 AMelizarov
03/20/2017, 8:31 AMkirillrakhman
03/20/2017, 8:32 AMinline fun launchWithDismiss(block: suspend () -> Unit) = launch(handleExceptions = true) {
try {
block()
} finally {
dismissAllowingStateLoss()
}
}
is this also covered by the issue?elizarov
03/20/2017, 8:37 AMblock param. Should also work without “noinline” modifier if the issue I’ve quoted is fixed.elizarov
03/20/2017, 8:38 AMkirillrakhman
03/20/2017, 8:39 AMinline with noinline and leaving out inline altogether, right?elizarov
03/20/2017, 8:40 AMelizarov
03/20/2017, 8:40 AMlaunch, then you don’t need it.elizarov
03/20/2017, 8:41 AMCoroutineExceptionHandlerelizarov
03/20/2017, 8:41 AMkirillrakhman
03/20/2017, 8:42 AMkirillrakhman
03/20/2017, 8:42 AMelizarov
03/20/2017, 8:42 AMelizarov
03/20/2017, 8:43 AMval job = launch(context) { … doSomething ... }
launch(context + NonCancellable) { // !!!
job.await()
dismissAllowingStateLoss()
}kirillrakhman
03/20/2017, 8:44 AMelizarov
03/20/2017, 8:44 AMkirillrakhman
03/20/2017, 8:45 AMelizarov
03/20/2017, 8:46 AMelizarov
03/20/2017, 8:47 AMdismiss when the original code completes (including whatever other cleanup there was), while my code invokes dismiss as soon as the job is cancelled (it may invoke dismiss before doSomething code had terminated)kirillrakhman
03/20/2017, 8:49 AMdeviant
03/20/2017, 9:25 AMkirillrakhman
03/20/2017, 9:27 AMDialogFragment that has retainInstance = truekirillrakhman
03/20/2017, 9:27 AMdeviant
03/20/2017, 9:28 AMkirillrakhman
03/20/2017, 9:29 AM