Skip to content

Display gif in a spawned engine crashes after parent engine destroyed #94159

@eggfly

Description

@eggfly

It can be solved by this PR: flutter/engine#29915

Steps to Reproduce

  1. Open the app
  2. Click the "Next" button
  3. Click the second "我知道了" in the flutter instance of half of the bottom screen
  4. Click the "RemoveFirst" button then it will crash.

WX20211124-213108@2x

image

Expected results: It's ok and don't crash.

Actual results: It crashed.

Code sample

It's as same as https://github.com/flutter/samples/tree/master/add_to_app/multiple_flutters

if (needShow)
          Padding(
            padding: const EdgeInsets.only(left: 24, right: 24),
            child: Image.asset(
                'images/mabaoguo.gif', // <-- here a gif
                fit: BoxFit.fill),
          ),
        button.text = "RemoveFirst"
        button.setOnClickListener {
            fragmentManager.beginTransaction().remove(firstFragment!!).commitNow()
            FlutterEngineCache.getInstance().remove(0.toString())
            topBindings.detach()
            isFirstRemove = true
        }

    /**
     * This tears down the messaging connections on the platform channel and the DataModel.
     */
    fun detach() {
        // TODO: Uncomment after https://github.com/flutter/engine/pull/24644 is on stable.
         engine.destroy();
        DataModel.instance.removeObserver(this)
        channel.setMethodCallHandler(null)
    }
Logs
2021-11-24 21:30:20.221 11369-11451/dev.flutter.multipleflutters A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 11451 (1.io), pid 11369 (ultipleflutters)
2021-11-24 21:30:20.268 11481-11481/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: Build fingerprint: 'Xiaomi/umi/umi:11/RKQ1.200826.002/21.7.28:user/release-keys'
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: Revision: '0'
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: ABI: 'arm'
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: Timestamp: 2021-11-24 21:30:20+0800
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: pid: 11369, tid: 11451, name: 1.io  >>> dev.flutter.multipleflutters <<<
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: uid: 10350
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG: Cause: null pointer dereference
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG:     r0  00000000  r1  00000000  r2  00000000  r3  00000000
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG:     r4  ba4661a0  r5  c04e6da8  r6  c4d936c5  r7  c04e6dc0
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG:     r8  00000001  r9  c2b6df80  r10 00000000  r11 00000069
2021-11-24 21:30:20.269 11481-11481/? A/DEBUG:     ip  c533d230  sp  c2b6df00  lr  c4d8c87f  pc  c5061a3c
2021-11-24 21:30:20.315 920-2330/? E/CamX: [ERROR][NCS    ] camxncsintfqsee.cpp:2208 FillSensorData() Invalid sensor index -1
2021-11-24 21:30:20.331 11481-11481/? A/DEBUG: backtrace:
2021-11-24 21:30:20.331 11481-11481/? A/DEBUG:       #00 pc 0151da3c  /data/app/~~2IpoKhzv3XH25FXTfH4Bcw==/dev.flutter.multipleflutters-KgF_VwKmEzFMIkqNVCogNg==/base.apk!libflutter.so (offset 0x107b000) (BuildId: 88f02ec203436ab8cdb69e38b00ff4c9f2d66dc0)
2021-11-24 21:30:20.331 11481-11481/? A/DEBUG:       #01 pc 000fbf96  [anon:stack_and_tls:11451]
[✓] Flutter (Channel master, 2.6.0-12.0.pre.789, on macOS 12.0.1 21A559 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.6.0-12.0.pre.789 at /Users/eggfly/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6ae721de3d (3 days ago), 2021-11-21 15:22:37 -0500
    • Engine revision ad00d12833
    • Dart version 2.16.0 (build 2.16.0-35.0.dev)
    • DevTools version 2.8.0
    • Pub download mirror https://dart-pub.byted.org

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/eggfly/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/eggfly/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.0.1 21A559 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 96.0.4664.55

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions