Skip to content

On iOS, plugins have no opportunity to cleanup when FlutterEngines are deallocated #44256

@talisk

Description

@talisk
➜flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F203,
    locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version
    29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
[✓] VS Code (version 1.39.2)
[✓] Connected device (1 available)
• No issues found!

As we all know, the engine will free memory when I call destroyContext. But after the calling, some platform messages which were sent from Dart code cannot be received by native code, handleMethodCall won't be called.
So there is a serious problem. Some plugins need to do something after the dealloc calling. For example, "video_player" plugin will remove observer of the player's KVO. After calling destroyContext, the message "dispose" won't be received. And the KVO's observer won't be removed, the app will crash.
What is the suitable time to call the destroyContext on iOS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flowc: new featureNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)customer: alibabacustomer: handengineflutter/engine related. See also e: labels.packageflutter/packages repository. See also p: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions