Skip to content

Shell:OnPlatformViewDestroyed not working with thread merging #57067

@cyanglaz

Description

@cyanglaz

The current implementation Shell:OnPlatformViewDestroyed is not compatible with thread merging.

For example on iOS, imagine an app contains a google map. When the map first shows up, the system alert view pops up for a location permission. The system alert view then triggers the ApplicationWillResignActive, which triggers Shell:OnPlatformViewDestroyed on the platform thread.
At the same time, the threads are about to merge on the raster thread because the google map view is about to show up at the next frame. If the merging thread happened after we check if the threads are merged here (We are not checking the thread merging now, which we also need to fix. But that's not the main issue here), we will still post the task to the "raster_task_runner" here. And the posted task is actually going to run on the platform thread, because the threads are merged when the task started. It leads to a dead lock because the platform thread is still waiting for this posted task to release it.

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: platform-viewsEmbedding Android/iOS views in Flutter appsengineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions