using 1.3.0-rc-116, I start getting these errors: ...
# kotlin-native
k
using 1.3.0-rc-116, I start getting these errors: "Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared a.b.c.MyServicesFactory@c0820608 from other thread" Does it mean, that in future, we need to create all kotlin objects in same thread?
I created kotlin object in main thread, and tried to use it from background thread. (Normal swift app, where kotlin code used as library).
s
https://github.com/JetBrains/kotlin-native/blob/master/IMMUTABILITY.md top-level vals are only accessible from main thread, and you need to mark them either as
@SharedImmutable
or
@ThreadLocal
. Top-level objects are shared and frozen by default
👍 1
k
thx
a
did you fix it? I read the page but I didn't understand how I need to change my code