https://kotlinlang.org logo
Title
t

theapache64

10/24/2021, 6:55 PM
🤔 What’s actually happening inside
::exitApplication
?
System.exit(0)
or something special? Just curious 😬
2
c

CLOVIS

10/24/2021, 8:10 PM
If you're in IntelliJ, you can press CTRL+B and find out 👍
t

theapache64

10/24/2021, 8:16 PM
Ctrl/Cmd + B goes to the interface, not to the implementation. but I’ve looked in the
ApplicationScope
and found this 😄 if am not wrong, it simply update a boolean state to false, and when recomposed, we’re not rendering the
content
. If we’re not rendering anything, the
recomposer
will end the app ? I don’t get that part actually 🤔
k

Kirill Grouchnikov

10/24/2021, 8:59 PM
I'm right in that area right now in Aurora. I think this is causing the window to not get opened, or rather, disposed. And then, when the last window is disposed, the whole app exits automatically.
✔️ 1
i

Igor Demin

10/24/2021, 9:03 PM
When we call
recomposer.close()
we actually don't close or cancel anything. We just tell Recomposer, that when it has no active coroutines (usually launched via
LaunchedEffect
), it should shutdown itself, and no longer do any recompositions. When it will shutdown,
join
will unblock the main coroutine. If we use
Window
, it: 1. creates its own
LaunchedEffect
to keep
Recomposer
alive. 2. creates a native window on composition init, disposes the native window on composition dispose When we call
exitApplication
(i.e. set
isOpen = false
) we dispose all compositions, and so cancel all `LaunchedEffect`'s, and dispose all native windows, opened inside
application
t

theapache64

10/24/2021, 9:05 PM
@Igor Demin Aaaah.. makes sense. In that case, IMO, the name
close
doesn’t suite here, isn’t it ? or I don’t knw 😄 maybe
closeWhenNothingToCompose()
😄 and this method should be a
suspend
method (so we can remove
join
from there) and that make becomes more readable i guess… just a wild thought 😬
i

Igor Demin

10/24/2021, 9:21 PM
Yeah, naming is hard...
k

Kirill Grouchnikov

10/25/2021, 4:26 AM
https://github.com/JetBrains/compose-jb/issues/872 is the context for my exploration of the
application
implementation details
👍 1