Hi :wave: not sure if this thread is the right one...
# gui
m
Hi 👋 not sure if this thread is the right one (it's actually cross-topic 😄 ). I wrote a small example App that uses all of these technologies - KTor, Coroutines, DateTime, LibUI. There is a Button with text "Async Test" - it works, but when the App is closed, crashed that on FrozenException. Does anybody know how to properly combine the threads/coroutines with KTor and libUI? 🤔 https://github.com/sobotkami/fahrplan-libui/blob/main/src/nativeMain/kotlin/main.kt
m
I took a quick look and I see your are updating a label "testLabel" in a different thread? You most likely can't update GUI elements from other threads. Every GUI toolkit I've used has that requirement.
Copy code
val testLabel = label("Async Test")
                button("Async Test") {
                    action {
                        val api = ApplicationApi()

                        api.about {
                            GlobalScope.apply {
                                launch(Dispatchers.Main) {
                                    testLabel.text = it
                                }
                            }
                        }
                    }
                }