Fix spurious failure of interop_objc_smoke:testObjCWeakRef
This commit is contained in:
committed by
GitHub
parent
a27fe524ce
commit
f645a10aa0
@@ -596,7 +596,14 @@ fun testObjCWeakRef0(deallocListener: DeallocListener) = withWorker {
|
|||||||
obj.freeze()
|
obj.freeze()
|
||||||
|
|
||||||
runInWorker {
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user