Skip to content

[IOS] When the obscureText parameter of CupertinoTextField is set to true, the focus is requested, then the focus is lost, and the application crashes #77139

@changleibox

Description

@changleibox

Steps to Reproduce

  1. CupertinoTextField设置obscureText为true;
  2. 点击输入框,请求焦点,键盘弹出,点击空白处失去焦点,键盘收起;
  3. 程序崩溃;
  4. 一次不行,就多重复以上步骤几次;

Expected results:
程序正常运行

Actual results:
程序崩溃

Logs
[Bugly] Fatal signal(11) raised.
[  +23 ms] [Bugly]  Trapped fatal signal 'SIGSEGV(11)' 
           (
                0  ???                            0x0000000f2017378b 0x000000000000ffff + 0,
                1  Flutter                        0x00000001030a0963
_ZN7flutter19AccessibilityBridge15UpdateSemanticsENSt3__113unordered_mapIiNS_13SemanticsNodeENS1_4hashIiEENS1_8equal_toIiEENS1_9allocatorINS1_4pairIKiS3_EEEEEENS2_IiNS_25CustomAccessibilityActionES5_S7_NS8_INS9_ISA_SE_EEEEEE + 547,
                2  Flutter                        0x00000001030aac76
_ZN7flutter15PlatformViewIOS15UpdateSemanticsENSt3__113unordered_mapIiNS_13SemanticsNodeENS1_4hashIiEENS1_8equal_toIiEENS1_9allocatorINS1_4pairIKiS3_EEEEEENS2_IiNS_25CustomAccessibilityActionES5_S7_NS8_INS9_ISA_SE_EEEEEE + 80,
                3  Flutter                        0x0000000103443762
_ZNSt3__110__function6__funcIZN7flutter5Shell23OnEngineUpdateSemanticsENS_13unordered_mapIiNS2_13SemanticsNodeENS_4hashIiEENS_8equal_toIiEENS_9allocatorINS_4pairIKiS5_EEEEEENS4_IiNS2_25CustomAccessibilityActionES7_S9_NSA_INSB_ISC_SG_EEEEEEE4$_36NSA_ISK_EEFvvEEclEv + 108,
                4  F<…>
[+1005 ms] [Bugly] Forward signal(11) to the previous handler: 0x0
No issues found! (ran in 5.8s)
[✓] Flutter (Channel dev, 1.27.0-8.0.pre, on macOS 11.2.2 20D80 darwin-x64, locale zh-Hans-CN)
    • Flutter version 1.27.0-8.0.pre at /Users/changlei/Downloads/flutter
    • Framework revision b7d4806243 (12 days ago), 2021-02-19 09:22:45 -0800
    • Engine revision 6993cb229b
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/changlei/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • ANDROID_HOME = /Users/changlei/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.7759

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

[✓] Connected device (4 available)
    • Box (mobile)                                 • 22638e6260b59d12da776a809ee5fec9870aa041 • ios            • iOS 14.4
    • iPad Pro (11-inch) (2nd generation) (mobile) • 5957F313-57B2-4F38-BD84-C656437FC3E3     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • macOS (desktop)                              • macos                                    • darwin-x64     • macOS 11.2.2 20D80 darwin-x64
    • Chrome (web)                                 • chrome                                   • web-javascript • Google Chrome 88.0.4324.192

• No issues found!
Example
class __ContentState extends State<_Content> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TextField设置obscureText=true,导致崩溃问题'),
      ),
      body: Container(
        padding: const EdgeInsets.all(10),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            const Expanded(
              child: CupertinoTextField(
                padding: EdgeInsets.symmetric(
                  vertical: 15,
                  horizontal: 15,
                ),
                obscureText: true,
              ),
            ),
            CupertinoButton(
              child: const Text('Set text'),
              onPressed: () {
                FocusManager.instance.primaryFocus?.unfocus();
              },
            ),
          ],
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

Labels

a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)c: fatal crashCrashes that terminate the processc: regressionIt was better in the past than it is nowf: cupertinoflutter/packages/flutter/cupertino repositoryf: focusFocus traversal, gaining or losing focusf: material designflutter/packages/flutter/material repository.found in release: 1.27Found to occur in 1.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions