Repository: JetBrains/compose-multiplatform

Issue #1173: NullPointerException on UI thread when an empty LazyColumn is displayed
Created: 2021-09-16T07:08:53Z
Reproduce:
Click on the disabled OutlinedTextField created with the below code
OS: MacOS
Version:
    kotlin("jvm") version "1.5.30"
    id("org.jetbrains.compose") version "1.0.0-alpha4-build344"

My code:
@Composable
fun platformUrlInput(viewModel: ManagePageViewModel) {
    val platformUrlEnabled by viewModel.platformUrlEnabled.collectAsState()
    val url by viewModel.meetingUrl.collectAsState()
    Row {
        Switch(checked = platformUrlEnabled, onCheckedChange = { }, enabled = false)
        Text("URL:")
        OutlinedTextField(
            shape = RoundedCornerShape(50),
            colors = TextFieldDefaults.outlinedTextFieldColors(
                focusedBorderColor = R.color.primary,
                unfocusedBorderColor = R.color.grey
            ),
            value = url,
            onValueChange = viewModel::onUrlChange,
            keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii),
            modifier = Modifier.fillMaxWidth(),
            enabled = platformUrlEnabled
        )
    }
}
Stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at androidx.compose.ui.platform.SkiaLayer.isInLayer-k-4lQ0M(SkiaLayer.desktop.kt:128)
	at androidx.compose.ui.node.LayoutNodeWrapper.withinLayerBounds-3MmeM6k(LayoutNodeWrapper.kt:639)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:77)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui(LayoutNode.kt:846)
	at androidx.compose.ui.node.InnerPlaceable.hitTest-9KIMszo(InnerPlaceable.kt:146)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui(LayoutNode.kt:846)
	at androidx.compose.ui.node.InnerPlaceable.hitTest-9KIMszo(InnerPlaceable.kt:146)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui(LayoutNode.kt:846)
	at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:66)
	at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog$default(PointerInputEventProcessor.kt:50)
	at androidx.compose.ui.platform.DesktopOwner.processPointerInput-8iAsVTc$ui(DesktopOwner.desktop.kt:326)
	at androidx.compose.ui.platform.DesktopOwners.onMouseMoved(DesktopOwners.desktop.kt:193)
	at androidx.compose.ui.awt.ComposeLayer$initCanvas$3$mouseMoved$1.invoke(ComposeLayer.desktop.kt:211)
	at androidx.compose.ui.awt.ComposeLayer$initCanvas$3$mouseMoved$1.invoke(ComposeLayer.desktop.kt:210)
	at androidx.compose.ui.awt.AWTDebounceEventQueue$job$1.invokeSuspend(AWTDebounceEventQueue.desktop.kt:59)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Duplicate issue #1242: Many cases of "Exception in thread "AWT-EventQueue-0 @coroutine#5" java.lang.NullPointerException" in Compose desktop
Created: 2021-10-08T19:39:50Z
Hello everyone! I'm stuck in development with Compose for desktop because of the following exception:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at androidx.compose.ui.platform.SkiaLayer.isInLayer-k-4lQ0M(SkiaLayer.desktop.kt:128)
	at androidx.compose.ui.node.LayoutNodeWrapper.withinLayerBounds-3MmeM6k(LayoutNodeWrapper.kt:639)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:77)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui(LayoutNode.kt:846)
	at androidx.compose.ui.node.InnerPlaceable.hitTest-9KIMszo(InnerPlaceable.kt:146)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.hitTest-9KIMszo(DelegatingLayoutNodeWrapper.kt:79)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui(LayoutNode.kt:846)
	at androidx.compose.ui.node.LayoutNode.hitTest-9KIMszo$ui$default(LayoutNode.kt:840)
	at androidx.compose.ui.platform.DesktopOwner.onPointerEnter-k-4lQ0M$ui(DesktopOwner.desktop.kt:405)
	at androidx.compose.ui.platform.DesktopOwners.onMouseEntered(DesktopOwners.desktop.kt:211)
	at androidx.compose.ui.awt.ComposeLayer$initCanvas$2$mouseEntered$1.invoke(ComposeLayer.desktop.kt:191)
	at androidx.compose.ui.awt.ComposeLayer$initCanvas$2$mouseEntered$1.invoke(ComposeLayer.desktop.kt:190)
	at androidx.compose.ui.awt.AWTDebounceEventQueue$job$1.invokeSuspend(AWTDebounceEventQueue.desktop.kt:59)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)

It overtakes me on a variety of occasions. The easiest way to reproduce is to write the following code:
var testsState by remember {
    mutableStateOf<List<String>?>(null)
}
LaunchedEffect(Unit) {
    delay(2000)
    testsState = listOf("Hello")
}
LazyColumn {
    val tests = testsState
    if (tests != null) items(tests) { Text(it) }
}

and quickly move the mouse while the LaunchedEffect coroutine continues.
It also happens with other launches of coroutines, and very often when using TextField with DropdownMenu under it.

Closing comment (2021-10-14T14:28:54Z): It looks like a duplicate of #1173