Fix spurious failure of interop_objc_smoke:testObjCWeakRef

This commit is contained in:
SvyatoslavScherbina
2020-04-08 15:21:49 +03:00
committed by GitHub
parent a27fe524ce
commit f645a10aa0
@@ -596,8 +596,15 @@ fun testObjCWeakRef0(deallocListener: DeallocListener) = withWorker {
obj.freeze() obj.freeze()
runInWorker { runInWorker {
// [deallocListener.deallocExecutorIsNil()] calls deallocExecutor getter, which retains [obj] and either
// puts it to autoreleasepool or releases it immediately (Obj-C ARC optimization).
// Wrap the call to autoreleasepool to ensure [obj] will be released:
autoreleasepool {
assertFalse(deallocListener.deallocExecutorIsNil()) assertFalse(deallocListener.deallocExecutorIsNil())
} }
// Process release of Kotlin reference to [obj] in any case:
kotlin.native.internal.GC.collect()
}
} }
private fun Worker.runInWorker(block: () -> Unit) { private fun Worker.runInWorker(block: () -> Unit) {