If I pass
state = WindowState(width = 1000.dp, height = 1000.dp)
into a Window I get the following exception when it's recomposed:
Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The window is showing on screen.
at java.desktop/java.awt.Window.setLocationByPlatform(Window.java:3504)
at androidx.compose.ui.util.Windows_desktopKt.setLocationByPlatformSafely(Windows.desktop.kt:127)
at androidx.compose.ui.util.Windows_desktopKt.setPositionSafely(Windows.desktop.kt:99)
at androidx.compose.ui.util.Windows_desktopKt.setPositionSafely(Windows.desktop.kt:57)
at androidx.compose.ui.window.Window_desktopKt$Window$5.invoke(Window.desktop.kt:210)
at androidx.compose.ui.window.Window_desktopKt$Window$5.invoke(Window.desktop.kt:156)
at androidx.compose.ui.window.Window_desktopKt$Window$11$1.invoke(Window.desktop.kt:377)
at androidx.compose.ui.window.Window_desktopKt$Window$11$1.invoke(Window.desktop.kt:374)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$3.invoke(AwtWindow.desktop.kt:84)
at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$3.invoke(AwtWindow.desktop.kt:82)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2$performUpdate$2.invoke(UpdateEffect.desktop.kt:58)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2$performUpdate$2.invoke(UpdateEffect.desktop.kt:54)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:1798)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:121)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2.invoke$performUpdate(UpdateEffect.desktop.kt:54)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2.access$invoke$performUpdate(UpdateEffect.desktop.kt:47)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2$performUpdate$1$1.invoke(UpdateEffect.desktop.kt:56)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$2$performUpdate$1$1.invoke(UpdateEffect.desktop.kt:56)
at androidx.compose.ui.util.UpdateEffect_desktopKt$UpdateEffect$1.invokeSuspend(UpdateEffect.desktop.kt:43)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(CoroutineDispatchers.skiko.kt:51)
at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2$1.invoke(CoroutineDispatchers.skiko.kt:46)
at androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun(CoroutineDispatchers.skiko.kt:78)
at androidx.compose.ui.platform.FlushCoroutineDispatcher.access$performRun(CoroutineDispatchers.skiko.kt:29)
at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(CoroutineDispatchers.skiko.kt:46)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
If I pass
state = WindowState(width = 1000.dp, height = 1000.dp)
into a Window I get the following exception when it's recomposed:
Source code to repro can be found here: https://gist.github.com/andreasnilsson/e88cffbd87c0ab558101f5d7db03cc89
Some more info: Machine: Apple M1 MacOS 12.6
Gradle project is the default Compose Desktop project generated with IntelliJ 2021.3.3