David Stolarsky
05/21/2019, 8:47 AMEXC_BAD_ACCESS
in an Objective-C++ object deallocation stack in thread Queue: com.google.firebase.firestore (serial)
where it is, er, "releasing its reference" to a Swift closure I passed it. Inside the Swift closure is a reference* to a Kotlin lambda that was passed into my Swift code from my Kotlin code. when I refactor the code to not pass the Kotlin lambda into Swift, the crash (seems to**) go away. Am I missing something obvious? Should I .freeze()
that lambda?
*The Kotlin lambda does not need to be called for the crash to occur.
**The crash is known to both occur and not occur without any code changes, but I seem to have found a configuration where it reliably happened 100% of the time, then refactoring out the lambda made it go away.. could theoretically still be a red herring.svyatoslav.scherbina
05/21/2019, 9:23 AMin threadKnown issue. You have incorrect object sharing.where it is, er, “releasing its reference” to a Swift closure I passed it. Inside the Swift closure is a reference* to a Kotlin lambdaQueue: com.google.firebase.firestore (serial)
Should IThis should help.that lambda?.freeze()
David Stolarsky
05/21/2019, 9:57 AMDavid Stolarsky
05/21/2019, 9:58 AMDavid Stolarsky
05/21/2019, 9:58 AMsvyatoslav.scherbina
05/21/2019, 11:08 AMwhat do you mean?I mean that freezing lambda will likely fix the issue.
is the known issue documented somewhere?https://kotlinlang.org/docs/reference/native/concurrency.html#object-transfer-and-freezing In Kotlin/Native you can’t share a mutable object with other thread.