Skip to content

iOS: isGpuDisabled set before engine start is silently clobbered by createShell #190835

Closed

Description

@cbracken

FlutterEngine.isGpuDisabled is a public read/write property, but a value assigned to it before the engine runs is silently clobbered before it ever reaches the shell.

-[FlutterEngine createShell:libraryURI:initialRoute:] samples the current lifecycle state by assigning to the property, immediately before constructing the shell:

// Disable GPU if the app or scene is running in the background.
self.isGpuDisabled = self.viewController
? self.viewController.stateIsBackground
: FlutterSharedApplication.application &&
FlutterSharedApplication.application.applicationState ==
UIApplicationStateBackground;

The value is then passed to Shell::Create as is_gpu_disabled. Because the sampling is an unconditional assignment to a public property, it also destroys whatever the caller set beforehand. An embedder that does:

engine.isGpuDisabled = YES;
[engine run];

silently gets the GPU enabled, with no warnings whatsoever.

The sampling itself is necessary and shouldn't be deleted. Lifecycle notifications only report transitions, so an engine created while the application or scene is already backgrounded never receives one and would otherwise come up believing the GPU is available.

The problem is more with where we do this work and the fact that it silently clobbers the state with no warning.

Why is this a problem for Embedder API migration?

FlutterEngineRun would naturally accept initial GPU availability as a project argument, if we add it. Passing that property straight through would resurrect exactly the stale value that createShell: currently goes out of its way clobber.

Activity

  1. self-assigned this
    on Aug 10, 2026
  2. github-actions commented on Sep 1, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  3. locked as resolved and limited conversation to collaborators on Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: qualityA truly polished experienceplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions