saket
09/08/2019, 2:55 AMnapperley
09/08/2019, 9:04 AMSam Schilling
09/09/2019, 5:42 PMSlackbot
09/09/2019, 10:26 PMSam Schilling
09/10/2019, 9:52 PMrobjperez
09/11/2019, 10:10 AMribesg
09/12/2019, 8:30 AMribesg
09/12/2019, 9:59 AMkotlin.native.concurrent.InvalidMutabilityException
that I can’t explain.
companion object {
internal var xs: Set<X> by atomic(HashSet())
private set
fun registerX(x: X) {
xs = xs + x
}
}
atomic
being:
inline fun <reified T> atomic(initial: T) = AtomicDelegate(initial)
AtomicDelegate
being:
class AtomicDelegate<T>(initial: T) : ReadWriteProperty<Any?, T> {
private val atomic = AtomicReference(initial)
override fun getValue(thisRef: Any?, property: KProperty<*>): T =
atomic.get()
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
atomic.set(value)
}
}
And AtomicReference
here is:
internal actual class AtomicReference<T> actual constructor(initial: T) {
private val atomic =
kotlin.native.concurrent.FreezableAtomicReference(initial)
actual fun get(): T =
atomic.value
actual fun set(newValue: T) {
atomic.compareAndSet(get(), newValue)
}
}
The app crashes when registerX
is called:
Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.collections.HashSet@221c288
Where in my code am I attempting to modify a frozen HashSet
? I’m pretty sure I’m just creating a new local one, modifying it, then assigning it which makes it frozen (that’s what the +
does)Nabil
09/12/2019, 1:15 PMnew
to produce non compiling code, I created an issue https://github.com/JetBrains/kotlin-native/issues/3336 in case others are also experimenting with using Cocoapods dependencies and hitting an `this annotation is not applicable to target 'getter'`…Erik Christensen
09/12/2019, 2:03 PMOren Idan
09/13/2019, 6:19 AM1.3.60
will be out?
I need to support more than 22 properties in SQLDelight...
https://github.com/JetBrains/kotlin-native/issues/3072Sebastian Keller
09/13/2019, 2:12 PMIncorrectDereferenceException
? I want to use the iOS CMAltimeter class, but it's callback gets called from a non-main-thread when altimeter?.stopRelativeAltitudeUpdates()
is called. I tried a surrounding try
and catch
, but no luck. I can not freeze the callback, because that would freeze update()
too. I really don't know what else to do right now.
altimeter = CMAltimeter()
altimeter?.startRelativeAltitudeUpdatesToQueue(NSOperationQueue.mainQueue) { data: CMAltitudeData?, error: NSError? ->
update(data.pressure.doubleValue)
}
Can the relaxed mode help? If so, how to enable it?Sam Schilling
09/13/2019, 4:50 PMclass Agent(
val var1: String,
val var2: String,
val var3: String,
val var4: String,
val var5: String,
val var6: String,
val var7: String,
val var8: Boolean = false,
val var9: String? = null,
val var10: String? = null
)
And simply allocating it in Swift, i.e., var agent = Agent(...)
sometimes results in a memory leak. This even happens when all I do is allocate the object and nothing else references it. The same behavior applies when I put the object declaration in an autoreleasepool.
Below is an image of what Xcode’s debug memory graph shows occasionally when there’s a leak.RayeW47
09/14/2019, 11:46 AMOla Gawell
09/16/2019, 3:15 PMspierce7
09/16/2019, 3:29 PMSam Schilling
09/16/2019, 3:52 PMlet a: MyType = ...
print(a) // MyType@c56528
print(Unmanaged.passUnretained(a).toOpaque()) // 0x0000000100c56500
The second print should print the address of a
, whereas the first would just be the default toString for Kotlin objects, I don’t know why the addresses are slightly offset though.Vincent Chen
09/17/2019, 3:43 AMplugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.60-dev-1981'
}
repositories {
maven {
url '<https://dl.bintray.com/kotlin/kotlin-dev/>'
}
}
But it is error
Plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '1.3.60-dev-1981'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.3.60-dev-1981')
Searched in the following repositories:
Gradle Central Plugin Repository
How to do to fix it?
Thanksnapperley
09/17/2019, 4:35 AMcfg_init
from libconfuse) that is expecting a CValuesRef<cfg_opt_t>?
as the first argument. Using the cValuesOf
function returns CValues<CPointerVar<cfg_opt_t>>
which doesn't match. Below is the sample code:
val targetStr = configString(name = "target".cstr, def = "NONE".cstr, flags = CFGF_NONE)
val end = configEnd()
val config = cfg_init(cValuesOf(targetStr, end), CFGF_NONE)
napperley
09/18/2019, 5:12 AMCPointer<ByteVar>
works fine, however if the terminal input is written as a Kotlin String (eg data.cstr
) then the text in the output file looks garbled.Rostislav Utrobin
09/18/2019, 7:58 AMval bytes = byteArrayOf(1)
val mutableBytes = bytes.toMutableList()
It works fine, but if a byteArray contains negative value i got a crash on iOS (on Android works fine). It's easy to reproduce, example:
val bytes = byteArrayOf(-1)
val mutableBytes = bytes.toMutableList() /* got a crash here on iOS */
Does anybody have this issue?Jan Stoltman
09/18/2019, 8:14 AMbitcode bundle could not be generated because (...) was built without full bitcode.
when trying to build an archive of my app. Has anybody faced something like this before?Big Chungus
09/18/2019, 9:43 AMNikita Klimenko
09/18/2019, 4:00 PMSam Schilling
09/18/2019, 5:14 PMGC.collect()
results in Memory.cpp:987: runtime assert: Must be positive
Vincent Chen
09/19/2019, 8:42 AMnapperley
09/20/2019, 12:51 AMCPointer<ByteVar>?
) for reading data, that is converted to a Kotlin String
to do text manipulation, and is converted back to CPointer<ByteVar>?
(via the cstr
property) where it is written to a file.Vincent Chen
09/20/2019, 3:56 AMtargets {
// Android Arm64 Platform (Parent Platform)
androidNativeArm64("androidNativeArm64")
// Android Arm32 Platform
androidNativeArm32("androidNativeArm32")
// Configure Android
configure([androidNativeArm64, androidNativeArm32]) {
compilations.main.cinterops {
XXXXXX
}
binaries {
sharedLib {
baseName = "AndroidNative"
}
}
}
// *********************************************************
// iOS Arm64 Platform (Parent Platform)
iosArm64("iOSArm64")
// iOS X64 Platform
iosX64("iOSX64")
// Configure iOS
configure([iOSArm64, iOSX64]) {
compilations.main.cinterops {
XXXXXX
}
binaries {
framework {
baseName = "iOS"
}
}
}
// *********************************************************
// JVM Platform
jvm()
}
ThanksVincent Chen
09/20/2019, 6:52 AMbinaries {
sharedLib {
baseName = iOSArm64 or iOSX64
}
}
JoakimForslund
09/20/2019, 8:24 AM