[K/N] Fix tests failing in GC aggressive mode
This commit is contained in:
@@ -896,10 +896,6 @@ func testWeakRefs0(frozen: Bool) throws {
|
||||
Holder.ref2 = obj2
|
||||
}
|
||||
|
||||
try assertFalse(Holder.ref1 === nil)
|
||||
try assertFalse(Holder.ref2 === nil)
|
||||
try assertEquals(actual: Holder.deinitialized, expected: 0)
|
||||
|
||||
ValuesKt.gc()
|
||||
|
||||
try assertTrue(Holder.ref1 === nil)
|
||||
@@ -942,9 +938,13 @@ class TestSharedRefs {
|
||||
let ignore = SharedRefs() // Ensures that Kotlin runtime gets initialized.
|
||||
}
|
||||
|
||||
Closure.currentBlock!()
|
||||
// Take the block from Closure to avoid races when block() execution triggers
|
||||
// calling launchInNewThread on another thread (e.g. on the finalizer thread).
|
||||
let block = Closure.currentBlock!
|
||||
Closure.currentBlock = nil
|
||||
|
||||
block()
|
||||
|
||||
return nil
|
||||
}, nil)
|
||||
try! assertEquals(actual: createCode, expected: 0)
|
||||
|
||||
Reference in New Issue
Block a user