reactive/kotlinx-coroutines-rx2/src/RxCompletable.kt [20:55]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Its lifecycle should be managed via Disposable handle. Had $context" } return rxCompletableInternal(GlobalScope, context, block) } private fun rxCompletableInternal( scope: CoroutineScope, // support for legacy rxCompletable in scope context: CoroutineContext, block: suspend CoroutineScope.() -> Unit ): Completable = Completable.create { subscriber -> val newContext = scope.newCoroutineContext(context) val coroutine = RxCompletableCoroutine(newContext, subscriber) subscriber.setCancellable(RxCancellable(coroutine)) coroutine.start(CoroutineStart.DEFAULT, coroutine, block) } private class RxCompletableCoroutine( parentContext: CoroutineContext, private val subscriber: CompletableEmitter ) : AbstractCoroutine(parentContext, false, true) { override fun onCompleted(value: Unit) { try { subscriber.onComplete() } catch (e: Throwable) { handleUndeliverableException(e, context) } } override fun onCancelled(cause: Throwable, handled: Boolean) { try { if (subscriber.tryOnError(cause)) { return } } catch (e: Throwable) { cause.addSuppressed(e) } handleUndeliverableException(cause, context) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - reactive/kotlinx-coroutines-rx3/src/RxCompletable.kt [20:55]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Its lifecycle should be managed via Disposable handle. Had $context" } return rxCompletableInternal(GlobalScope, context, block) } private fun rxCompletableInternal( scope: CoroutineScope, // support for legacy rxCompletable in scope context: CoroutineContext, block: suspend CoroutineScope.() -> Unit ): Completable = Completable.create { subscriber -> val newContext = scope.newCoroutineContext(context) val coroutine = RxCompletableCoroutine(newContext, subscriber) subscriber.setCancellable(RxCancellable(coroutine)) coroutine.start(CoroutineStart.DEFAULT, coroutine, block) } private class RxCompletableCoroutine( parentContext: CoroutineContext, private val subscriber: CompletableEmitter ) : AbstractCoroutine(parentContext, false, true) { override fun onCompleted(value: Unit) { try { subscriber.onComplete() } catch (e: Throwable) { handleUndeliverableException(e, context) } } override fun onCancelled(cause: Throwable, handled: Boolean) { try { if (subscriber.tryOnError(cause)) { return } } catch (e: Throwable) { cause.addSuppressed(e) } handleUndeliverableException(cause, context) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -