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
+8 -1
View File
@@ -596,7 +596,14 @@ fun testObjCWeakRef0(deallocListener: DeallocListener) = withWorker {
obj.freeze()
runInWorker {
assertFalse(deallocListener.deallocExecutorIsNil())
// [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())
}
// Process release of Kotlin reference to [obj] in any case:
kotlin.native.internal.GC.collect()
}
}