Skip to content

Commit 54091f4

Browse files
qwwdfsadelizarov
authored andcommitted
Fix missing unbox state in native runBlocking
1 parent dc9ca27 commit 54091f4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

kotlinx-coroutines-core/native/src/Builders.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private class BlockingCoroutine<T>(
6666
fun joinBlocking(eventLoop: EventLoop?): T {
6767
runEventLoop(eventLoop) { isCompleted }
6868
// now return result
69-
val state = state
69+
val state = state.unboxState()
7070
(state as? CompletedExceptionally)?.let { throw it.cause }
7171
return state as T
7272
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines
6+
import kotlin.test.*
7+
8+
class RunBlockingTest : TestBase() {
9+
10+
@Test
11+
fun testIncompleteState() {
12+
val handle = runBlocking {
13+
coroutineContext[Job]!!.invokeOnCompletion { }
14+
}
15+
16+
handle.dispose()
17+
}
18+
}

0 commit comments

Comments
 (0)