JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.95k stars 1.16k forks source link

BoxWithTooltip causes error when alt-tabing while tooltip is not yet displayed #1073

Open rnett opened 3 years ago

rnett commented 3 years ago

Stacktrace:

Exception in thread "main" java.lang.NullPointerException: Cannot read field "x" because "awtMousePosition" is null
    at androidx.compose.ui.window.DesktopPopup_desktopKt.rememberCursorPositionProvider-B5uucgQ(DesktopPopup.desktop.kt:243)
    at androidx.compose.foundation.TooltipPlacement$CursorPoint.positionProvider(BoxWithTooltip.desktop.kt:180)
    at androidx.compose.foundation.BoxWithTooltip_desktopKt.BoxWithTooltip(BoxWithTooltip.desktop.kt:133)
    at androidx.compose.foundation.BoxWithTooltip_desktopKt$BoxWithTooltip$7.invoke(BoxWithTooltip.desktop.kt)
    at androidx.compose.foundation.BoxWithTooltip_desktopKt$BoxWithTooltip$7.invoke(BoxWithTooltip.desktop.kt)
    at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
    at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2162)
    at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2405)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2586)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2579)
    at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotState.kt:540)
    at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2572)
    at androidx.compose.runtime.ComposerImpl.recompose$runtime(Composer.kt:2548)
    at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:612)
    at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:764)
    at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:103)
    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:447)
    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:416)
    at androidx.compose.ui.window.YieldFrameClock.withFrameNanos(Application.desktop.kt:210)
    at androidx.compose.ui.window.YieldFrameClock$withFrameNanos$1.invokeSuspend(Application.desktop.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)

I have a BoxWithTooltip, and if I hover over it (but not long enough to show the tooltip), then alt-tab (this is on Windows), I get the above error. Doesn't always happen, so there may be more too it than that.

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.