Tao: track upstream CMP-10678 (RectManager EDT dispatch) and remove RectManagerEdtGuard once fixed

Open
#555 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
kotlin
Domain
desktop

Research direction

Start by reading the existing RectManagerEdtGuard and the owner-creation path where the proposed RectManager.executeDelayed swap would be attempted. Verify the reflective final-field write with the reachability metadata in a real runGraalvmNative build, while keeping the current guard as the fallback. Done means the swap removes the residual EDT dispatch when successful, failures warn and retain the guard, or the upstream Compose fix makes this follow-up obsolete.

Written by the indexing model from the issue text.

Description

Follow-up to #551 / PR #554.

RectManagerEdtGuard closes the Compose 1.12 RectManager EDT race for every app that does not register debounced rect callbacks. A documented residual remains: an app explicitly using Modifier.onLayoutRectChanged / onFirstVisible / onVisibilityChanged (with debounce) can still get one EDT dispatch if a layout pass runs >16 ms past a mid-pass re-arm with no layout/semantics notification in between — because a real (non-pinned) deadline lowers minDebounceDeadline and the pass-end scheduleDebounceCallback arms a live EDT timer that the guard can only cancel at the next observable hook.

Proposed full closure (opt-in, layered)

Swap RectManager.executeDelayed (private field) for a scene-thread implementation at owner creation:

  • The ExecuteDelayed implementation itself can be static (@Suppress("INVISIBLE_REFERENCE"), no dynamic Proxy) — it schedules delay(millis) on the scene's coroutine context, exactly like the guard's post-frame wakeup.
  • The only reflective operation is a single Field.set on RectManager.executeDelayed.
  • GraalVM native-image: needs one reachability-metadata field entry for androidx.compose.ui.spatial.RectManager; must verify on a real runGraalvmNative build that a reflective write to a final instance field works with the metadata (final-field writes are the sensitive part).
  • Layered behavior: attempt the swap at first owner; on success the residual disappears entirely; on any failure (missing metadata, future Compose renames the field) log one warning and keep the current guard — never worse than today.

Exit criterion

This issue becomes obsolete if JetBrains fixes the upstream bug (desktop postDelayed runs on skiko's hardcoded MainUIDispatcher/EDT — their code carries TODO CMP-7153; a standalone no-framework reproducer crashing 3/3 off-EDT and never on the EDT has been prepared for the YouTrack report). Once the upstream fix ships, both the guard and this follow-up can be removed for that Compose version.

Dominant language
Kotlin
Stars
393
Forks
27
Avg merge
17h 24m
Merged PRs (30d)
69

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NucleusFramework/Nucleus

All issues in NucleusFramework/Nucleus

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.