From 07add87d7b7ce252577a7573a4e9aeafceba8fa8 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 30 Apr 2019 18:22:13 +0300 Subject: [PATCH] Properly handle Kotlin from Objective-C allocations. (#2934) --- runtime/src/main/cpp/ObjCExport.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/src/main/cpp/ObjCExport.mm b/runtime/src/main/cpp/ObjCExport.mm index b6043d8812f..a3df899c98a 100644 --- a/runtime/src/main/cpp/ObjCExport.mm +++ b/runtime/src/main/cpp/ObjCExport.mm @@ -169,9 +169,9 @@ static void initializeObjCExport(); format:@"%s must be allocated and initialized with a factory method", class_getName(object_getClass(self))]; } - - AllocInstanceWithAssociatedObject(typeInfo, result, result->refHolder.slotToInit()); - + ObjHolder holder; + AllocInstanceWithAssociatedObject(typeInfo, result, holder.slot()); + UpdateHeapRef(result->refHolder.slotToInit(), holder.obj()); return result; }