Skip to content

iOS DisplayLinkManager should be main actor #190725

Open

Description

@hellohuanlin

Use case

Currently DisplayLinkManager is @unchecked Sendable:

final class DisplayLinkManager: NSObject, @unchecked Sendable {

And it relies on NSLock for synchronization:

Proposal

Since in iOS embedder ui / platform threads are merged, and there's no way to opt out, we should make it a MainActor (and remove the locks), as this is purely a UI bound concept.

CC @cbracken @LongCatIsLooong

Activity

  1. cbracken commented on Aug 10, 2026

    @cbracken
    Member

    This will be a while out but agreed that yes, whatever is left of this (if anything) should be mainActor. Right now there's still a lot of very delicate C++ threading around this.

  2. cbracken commented on Aug 13, 2026

    @cbracken
    Member

    Worth noting that this will cause crashes for certain people creating off-main-thread engines without additional work:
    #190909

    Whether that's a supported use-case or not is something we'll need to discuss. Assigning to @cbracken @LongCatIsLooong @hellohuanlin purely to come to agreement on how to address that issue and what it means for this one.

  3. added
    c: proposalA detailed proposal for a change to Flutter
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Aug 13, 2026
  4. added
    engineflutter/engine related. See also e: labels.
    on Aug 13, 2026
  5. cbracken commented on Aug 13, 2026

    @cbracken
    Member

    We should annotate [FlutterEngine run] this way too since that's what creates the DisplayLinkManager under the hood.

  6. hellohuanlin commented on Aug 18, 2026

    @hellohuanlin
    ContributorAuthor

    Right now there's still a lot of very delicate C++ threading around this.

    If we encounter a code where we know it must be main actor, but not yet known to the compiler due to C++, we could use MainActor.assumeIsolated API for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions