Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when rendering emoji text #107509

Closed
smileKH opened this issue Jul 13, 2022 · 22 comments
Closed

App crashes when rendering emoji text #107509

smileKH opened this issue Jul 13, 2022 · 22 comments
Labels
c: fatal crash Crashes that terminate the process dependency: skia Skia team may need to help us engine flutter/engine repository. See also e: labels. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list waiting for PR to land (fixed) A fix is in flight

Comments

@smileKH
Copy link

smileKH commented Jul 13, 2022

(๑•॒̀ ູ॒•́๑)啦啦啦

When using Text the display emoji, the APP flashes back,

@huycozy huycozy added the in triage Presently being triaged by the triage team label Jul 13, 2022
@huycozy
Copy link
Member

huycozy commented Jul 13, 2022

Hi @smileKH
When opening an issue, please try to provide all or some of the information indicated in the template so that we can address this issue properly.

Issue Template
If you are looking for support, please check out our documentation
or consider asking a question on Stack Overflow:
- https://flutter.dev/
- https://api.flutter.dev/
- https://stackoverflow.com/questions/tagged/flutter?sort=frequent

If you have found a bug or if our documentation doesn't have an answer
to what you're looking for, then fill our the template below. Please read
our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports

Steps to Reproduce

Please tell us exactly how to reproduce the problem you are running into.

Please attach a small application (ideally just one main.dart file) that
reproduces the problem. You could use https://gist.github.com/ for this.

If the problem is with your application's rendering, then please attach
a screenshot and explain what the problem is.

1. ...
2. ...
3. ...


Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
Which target OS version, for Web, browser, is the test system running?
Does the problem occur on emulator/simulator as well as on physical devices?

Target Platform:
Target OS version/browser:
Devices:

Run your application with `flutter run --verbose` and attach all the
log output below between the lines with the backticks. If there is an
exception, please see if the error message includes enough information
to explain how to solve the issue.

Run `flutter analyze` and attach any output of that command below.
If there are any analysis errors, try resolving them before filing this issue.

Finally, paste the output of running `flutter doctor -v` here.

Thank you.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 13, 2022
@smileKH
Copy link
Author

smileKH commented Jul 13, 2022

Steps to Reproduce
1、Execute flutter run on the code sample

Expected results:
Text can be displayed normally
1201657708152_ pic_hd

Actual results:
APP flash back, is a must

Note
This is true on iOS and Android
Will now
Flash back information

* thread #10, name = 'io.flutter.1.ui', stop reason = EXC_BAD_ACCESS (code=1, address=0x2c6292ea8)
    frame #0: 0x000000010514df8c Flutter`skia::textlayout::Run::calculateWidth(unsigned long, unsigned long, bool) const + 72
Flutter`skia::textlayout::Run::calculateWidth:
->  0x10514df8c <+72>: ldr    s1, [x8, x9]
    0x10514df90 <+76>: sbfiz  x9, x1, #3, #32
    0x10514df94 <+80>: ldr    s2, [x8, x9]
    0x10514df98 <+84>: fsub   s1, s1, s2
Target 0: (Runner) stopped.
Sample code
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const <Widget>[
            Text('(๑•॒̀ ູ॒•́๑)啦啦啦'),
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.1, on macOS 11.3 20E217 darwin-arm, locale zh-Hans-CN)
    • Flutter version 3.0.1 at /Applications/flutter_3.0.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (8 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2
    • Pub download mirror https://pub.dartlang.org
    • Flutter download mirror https://storage.flutter-io.cn

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

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

[✓] 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-7249189)

[✓] Connected device (3 available)
    • iPhone胡明波 (mobile) • 00008101-0005784E3C89001E • ios            • iOS 14.6 18F72
    • macOS (desktop)    • macos                     • darwin-arm64   • macOS 11.3 20E217 darwin-arm
    • Chrome (web)       • chrome                    • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 13, 2022
@huycozy
Copy link
Member

huycozy commented Jul 13, 2022

Hi @smileKH
I was running your sample code on the latest stable and master channels, there was no crash from my side.
But the emoji text is displayed differently than it is in the sample code.

Demo

Screen Shot 2022-07-13 at 18 15 47

Sample code
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const <Widget>[
            Text('(๑•॒̀ ູ॒•́๑)啦啦啦'),
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
    • Flutter version 3.0.4 at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (3 days ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

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

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

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

[!] Android Studio
    • Android Studio at /Applications/Android Studio Preview.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.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

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.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.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 3.1.0-0.0.pre.1627, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
    • Flutter version 3.1.0-0.0.pre.1627 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a2c2d1ad85 (4 hours ago), 2022-07-13 02:21:05 +0300
    • Engine revision 20038216ac
    • Dart version 2.18.0 (build 2.18.0-272.0.dev)
    • DevTools version 2.15.0

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

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13E113
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.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

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.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.69.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.44.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

As far as I can see, you are using the old Flutter version, the latest Flutter stable is 3.0.4 and the master is 3.1.0. Please try upgrading them and retry to see if this issue still reproduces.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 13, 2022
@smileKH
Copy link
Author

smileKH commented Jul 14, 2022 via email

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 14, 2022
@smileKH
Copy link
Author

smileKH commented Jul 14, 2022

When I run the relevant code with the latest version of Flutter, there will still be a flash backoff without any flash backoff information

Using TextField to enter the emoticon is the same
image

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const <Widget>[
            Text('(๑•॒̀ ູ॒•́๑)啦啦啦'),
            Text('(๑•॒̀ ູ॒•́๑)啦啦啦'),
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
Logs
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.0.1 21A559 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.0.4 at /Users/mx_117/Documents/flutter_3.0.4
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (13 days ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2
    • Pub download mirror https://pub.dartlang.org
    • Flutter download mirror https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/mx_117/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

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

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

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 1ACADA54-B44F-4D1D-B757-6FC7C21EC206 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 12.0.1 21A559 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 103.0.5060.114

[!] HTTP Host Availability
    ✗ HTTP host "https://pub.dartlang.org" is not reachable. Reason: Failed to connect to host in 10 seconds

! Doctor found issues in 2 categories.

@smileKH
Copy link
Author

smileKH commented Jul 14, 2022

The first run may not flash back, please run several times to see the result

@smileKH
Copy link
Author

smileKH commented Jul 14, 2022

I'm going to do another demo, and I'm going to type in the TextField multiple times and I'm going to see the flash back

https://user-images.githubusercontent.com/15364507/178888031-496eac7b-9286-4744-beac-6ae262351bc2.mp4
image

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
            Text(
              '(๑•॒̀ ູ॒•́๑)啦啦啦',
              style: Theme.of(context).textTheme.headline4,
            ),
            TextField()
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
flutter doctor -v
mx@MXdeMacBook-Pro newapp % flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.0.1 21A559 darwin-x64, locale
    zh-Hans-CN)
    • Flutter version 3.0.5 at /Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (8 hours ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2
    • Pub download mirror https://pub.dartlang.org
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /Users/mx/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2021.1)
    • 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.11+0-b60-7590822)

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

[✓] Connected device (3 available)
    • PBAM00 (mobile) • 8620a598 • android-arm64  • Android 8.1.0 (API 27)
    • macOS (desktop) • macos    • darwin-x64     • macOS 12.0.1 21A559 darwin-x64
    • Chrome (web)    • chrome   • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@huycozy
Copy link
Member

huycozy commented Jul 14, 2022

Hi @smileKH
Thanks for providing a recorded video, it's very helpful for us.
But it seems the issue only happens with emoji which contains text inside. I've tried with similar emoji (without text), it worked as normal.

Screen.Recording.2022-07-14.at.10.13.11.mov

Could you tell me what kind of keyboard app are you using? So that I can install and try reproducing this issue.
Thanks!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 14, 2022
@smileKH
Copy link
Author

smileKH commented Jul 14, 2022

Android phone sougo or Google the input method
image

image

find (๑•॒̀ ູ॒•́๑)啦啦啦 input

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 14, 2022
@huycozy
Copy link
Member

huycozy commented Jul 14, 2022

@smileKH

Android phone sougo or Google the input method

Could you please provide step by step to set up this keyboard with Google the input method? I tried adding Chinese language but there is still no emoji with Chinese text there.
Thanks!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 14, 2022
@jason-simmons
Copy link
Member

I can reproduce this by converting the emoji text to UTF-16 escape sequences:

import 'dart:convert';
import 'package:flutter/material.dart';

void main() {
  String s = '\u0028\u0e51\u2022\u0952\u0300\u0020\u0eb9\u0952\u2022\u0301\u0e51\u0029\u5566\u5566\u5566';
  runApp(Text(s, style: TextStyle(fontSize: 30.0, color: Colors.white), textDirection: TextDirection.ltr));
}

This crashes when run with Flutter 3.0.1 on iOS.

With the current Flutter master in debug mode I get an assertion from SkParagraph (the text width comparison assert in TextLine::iterateThroughVisualRuns). If I restart the app a few times it usually crashes.

On a modern Android device with the necessary fonts I am seeing the assert failure but not the crash.

@jason-simmons
Copy link
Member

This can be reproduced with some simpler strings:

'\u0eb9\u0952\u0301\u0e51A' reproduces the assert failure/crash

'\u0952\u0301' will render a tofu glyph for one of the characters.

The issue is happening because of some processing done by OneLineShaper::clusteredText. When a range of glyphs was not resolved by an attempt of shaping clusteredText maps that range back to the code unit range that needs to be reshaped.

clusteredText contains a findBaseChar function that scans for the closest grapheme cluster boundary to a code unit. clusteredText uses this to ensure that the code unit range starts and ends on these boundaries.

However, in this example text the unresolved glyphs are combining marks and other special cases that are not complete grapheme clusters. So clusteredText will extend the unresolved code unit range beyond the intended range, causing it to overlap with parts of the text that were already resolved. This causes errors later in the layout process.

I can get this text to render correctly by removing the calls to findBaseChar in OneLineShaper::clusteredText.

@Rusino What is the goal of the findBaseChar code?
Does the unresolved range need to cover a range of grapheme clusters? Or would it be sufficient for clusteredText to adjust the range to Unicode code point boundaries?

@huycozy
Copy link
Member

huycozy commented Jul 15, 2022

Thank @jason-simmons, now I can reproduce the issue on the latest stable and master channels.

  • For iOS and MacOS: after several times try restart application or re-run the project, the crash occurs.
  • For Android: there is no crash but assert log
  • For Web: tried to restart application, the assertion failed occurs
Logs - android (assert)
D/skia    (15626): ASSERT: 160.678619 != 168.120026
Logs - web (assertion failed)
Error: Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/canvaskit/surface_factory.dart:144:12
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3        assertFailed
lib/_engine/engine/canvaskit/surface_factory.dart 144:35                          isLive
lib/_engine/engine/canvaskit/surface.dart 236:16                                  [_contextLostListener]
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39  dcall
Logs - ios (crash)

ios_crash_log.txt

Sample code
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
	
	  String s = '\u0028\u0e51\u2022\u0952\u0300\u0020\u0eb9\u0952\u2022\u0301\u0e51\u0029\u5566\u5566\u5566';


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(s, style: TextStyle(fontSize: 30.0, color: Colors.black), textDirection: TextDirection.ltr)
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
    • Flutter version 3.0.5 at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (9 hours ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

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

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

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

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.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

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.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.69.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.44.0

[✓] Connected device (3 available)
    • SM T225 (mobile) • R9JT3004VRJ • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos       • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)     • chrome      • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[✓] Flutter (Channel master, 3.1.0-0.0.pre.1667, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
    • Flutter version 3.1.0-0.0.pre.1667 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0cf9d41fc9 (2 hours ago), 2022-07-15 07:21:11 +0700
    • Engine revision 64f98357ca
    • Dart version 2.18.0 (build 2.18.0-283.0.dev)
    • DevTools version 2.15.0

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

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13E113
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.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

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.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.69.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.44.0

[✓] Connected device (4 available)
    • Pixel 3a (mobile)  • 964AY0WL20                           • android-arm64  • Android 12 (API 32)
    • iPhone 13 (mobile) • 2526BC1A-435D-4B08-B99C-44B928F2517B • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 103.0.5060.114

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@huycozy huycozy added engine flutter/engine repository. See also e: labels. dependency: skia Skia team may need to help us has reproducible steps The issue has been confirmed reproducible and is ready to work on c: fatal crash Crashes that terminate the process found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels Jul 15, 2022
@huycozy huycozy changed the title Flutter`skia::textlayout::Run::calculateWidth(unsigned long, unsigned long, bool) const + 72 App crashes when rendering emoji text Jul 15, 2022
@chinmaygarde
Copy link
Member

This should be fixed when https://skia-review.googlesource.com/c/skia/+/559098 lands and is rolled in.

@chinmaygarde chinmaygarde added waiting for PR to land (fixed) A fix is in flight P2 Important issues not at the top of the work list labels Jul 18, 2022
@yianzhou
Copy link

This should be fixed when https://skia-review.googlesource.com/c/skia/+/559098 lands and is rolled in.

Hello, is this merged in flutter stable branch?

@gujintao1900
Copy link

App crash when Text render (ؑᵒᵕؑ̇ᵒ)◞✧

Widget _buildName() {
    debugPrint(widget.name);
    return Padding(
      padding: const EdgeInsets.only(bottom: 4),
      child: Text(widget.name, maxLines: 2),
    );
 }
flutter: 生日快乐(ؑᵒᵕؑ̇ᵒ)◞✧  // this line
flutter: 羽化成仙的众筹
* thread #8, name = 'io.flutter.1.ui', stop reason = EXC_BAD_ACCESS (code=1, address=0x17eebe2b0)
    frame #0: 0x0000000109308d8c Flutter`skia::textlayout::Run::calculateWidth(unsigned long, unsigned long, bool) const + 72
Flutter`skia::textlayout::Run::calculateWidth:
->  0x109308d8c <+72>: ldr    s1, [x8, x9]
    0x109308d90 <+76>: sbfiz  x9, x1, #3, #32
    0x109308d94 <+80>: ldr    s2, [x8, x9]
    0x109308d98 <+84>: fsub   s1, s1, s2
Target 0: (Runner) stopped.
Lost connection to device.
❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.5, on macOS 12.6 21G115 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.72.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

chifandeyu pushed a commit to FBSocial/skia that referenced this issue Dec 9, 2022
In some (rare) cases unresolved fonts were returned as resolved.
Notice, that the codepoints in one grapheme cluster will not be resolved with two different fonts and some of them will still show as tofu.

Bug: flutter/flutter#107509
Change-Id: Ieba0a898ccb56ac123e977d92668f940a1420c7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/559098
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
@wizardlyc
Copy link

I find this issue often happens when a text makes a wrong unicode combining .
for example, a Thai combine marks combine after a Lao character. iOS and some Android device will crash when rendering it.
For now, you can filter out all unicode combining marks from the text to avoid the issue.
use code like str = str.replaceAll(RegExp(r'\p{M}', unicode: true), "口");

@azhon
Copy link

azhon commented Mar 1, 2023

May I ask which Flutter version has fixed this problem?

@gnprice
Copy link
Member

gnprice commented Mar 2, 2023

I'm curious whether this still reproduces.

There was a commit mentioned above at #107509 (comment) that was expected to fix it. But @gujintao1900's later report #107509 (comment) appears to be the same issue (it has the same stack trace, and the string contains combining marks which was part of the original diagnosis), and was on 3.3 which came out well after that commit.

I tried @huycozy's repro from #107509 (comment) , on Android, with the current master/main channel. The string rendered and there was no assertion in the log, consistent with the issue having been fixed. But perhaps some other variable is affecting it.

@huycozy, would you perhaps repeat your repro to try to confirm whether it's been fixed?

If that finds the issue was fixed, then: @gujintao1900 @wizardlyc or anyone else, if you're still able to reproduce an issue like this on the current master, it would be very helpful to file a new issue and fill out all the details in the issue template, so those issues can be addressed too.

@azhon
Copy link

azhon commented Mar 2, 2023

@gnprice when i use 3.3.4 and 3.3.10 always reproduce(multiple hot reload/start), but use 3.7.5 is fine

@gnprice
Copy link
Member

gnprice commented Mar 4, 2023

@azhon Very helpful, thanks! In that case it seems this was fixed in 3.7.

I think that means it wasn't the Skia commit mentioned at #107509 (comment) that fixed it; but one way or another it was fixed, so closing.

If anyone's still seeing a similar bug on the current main/master channel, please file a new issue and fill out all the details in the issue template, so that that can also be addressed.

@gnprice gnprice closed this as completed Mar 4, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: fatal crash Crashes that terminate the process dependency: skia Skia team may need to help us engine flutter/engine repository. See also e: labels. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list waiting for PR to land (fixed) A fix is in flight
Projects
None yet
Development

No branches or pull requests

9 participants