Are there any notable changes to how StableRef wor...
# kotlin-native
b
Are there any notable changes to how StableRef works in Kotlin 1.4? We had some assumptions we made about what StableRef.asCPointer() means in Kotlin 1.3.x, which seem to have changed in 1.4
k
Interested to hear about this
b
Under-the-hood stuff definitely changed: https://github.com/JetBrains/kotlin-native/pull/3966
I think this broke some bad assumptions we made
quoting the the person actively debugging this at Autodesk: "I think the idea is that before the stable ref was just literally the pointer [to the object] and there was some bookkeeping off the side somewhere, but now the stable ref is itself a struct that holds some state, and that's what asCPointer is giving"
so before, we were "safely" reusing asCPointer in certain scenarios where that's not okay anymore
kind of vague, but: solution was to round-trip through kotlin to use the proper kotlin cinterop APIs instead of casting pointers in other languages in places we shouldn't have
k
I’m going to have to transition to cinterop as well, as previously discussed
b
Yeah so in this case, it's the reverse cinterop. For sqliter, you'll be dealing with cinterop Kotlin talking to C, which shouldn't be impacted here for the most part
💯 1