Closed
Description
Steps to reproduce
- On macOs, open the virtual keyboard (see attached screen shot)
- Build the app from the attached code sample
- Tap the "Toggle enabled" button
- Tap into the text field
- Type a character (with the real keyboard or the virtual one)
- The app crashes
Some combinations of opening the keyboard later and bringing the app to the background and to the foreground again seem to avoid the bad state. But we didn't find a reproducible arrangement.
We were able to reproduce this with compiled binaries on the following systems:
Apple M1 Pro with macOs 14.4
Mac Mini X86-64 with macOs 11.7.10
Mac Mini X86-64 with macOs 10.15.7
Expected results
It is possible to enter characters into the text field while macOs the virtual keyboard is open without crashing the app
Actual results
When entering a character in the text field while using the macOs virtual keyboard, the app crashes.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _enabled = false;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FilledButton(
onPressed: () {
setState(() {
_enabled = !_enabled;
});
},
child: const Text('Toggle enabled'),
),
// Crashes if on-screen-keyboard is open on macOs, it was toggled to enabled and you start typing something
TextField(
enabled: _enabled,
),
],
),
),
),
);
}
}
Screenshots or Video
Video showing the crash
TextField_enabled_bug.mov
Logs
Run console log
Launching lib/main.dart on macOS in debug mode...
Building macOS application...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-001A252A0C38801E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00006000-001A252A0C38801E, name:My Mac }
2024-07-08 20:03:14.132 example_text_field_enabled_crash[10899:65874836] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
Debug service listening on ws://127.0.0.1:56929/GS9Ga53mcdI=/ws
Syncing files to device macOS...
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AXPlatformNodeCocoa startEditing]: unrecognized selector sent to instance 0x6000035ea940'
*** First throw call stack:
(
0 CoreFoundation 0x000000019e23eccc __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000019dd26788 objc_exception_throw + 60
2 CoreFoundation 0x000000019e2f102c -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x000000019e1a8cdc ___forwarding___ + 1580
4 CoreFoundation 0x000000019e1a85f0 _CF_forwarding_prep_0 + 96
5 FlutterMacOS 0x0000000104299c04 _ZNK7flutter22AccessibilityBridgeMac22MacOSEventsFromAXEventEN2ui16AXEventGenerator5EventERKNS1_6AXNodeE + 1216
6 FlutterMacOS 0x0000000104299604 _ZN7flutter22AccessibilityBridgeMac20OnAccessibilityEventEN2ui16AXEventGenerator13TargetedEventE + 196
7 FlutterMacOS 0x0000000104afb24c _ZN7flutter19AccessibilityBridge13CommitUpdatesEv + 1584
8 FlutterMacOS 0x00000001042c7a9c -[FlutterViewController updateSemantics:] + 208
9 FlutterMacOS 0x00000001042ad35c _ZZ35-[FlutterEngine runWithEntrypoint:]EN3$_18__invokeEPK23FlutterSemanticsUpdate2Pv + 88
10 FlutterMacOS 0x0000000104b0cb60 _ZNSt3_fl10__function6__funcIZ39CreateEmbedderSemanticsUpdateCallbackV3PFvPK23FlutterSemanticsUpdate2PvES5_E3$_0NS_9allocatorIS8_EEFvNS_13unordered_mapIiN7flutter13SemanticsNodeENS_4hashIiEENS_8e 11 FlutterMacOS 0x0000000104b1eac8 _ZN7flutter20PlatformViewEmbedder15UpdateSemanticsENSt3_fl13unordered_mapIiNS_13SemanticsNodeENS1_4hashIiEENS1_8equal_toIiEENS1_9allocatorINS1_4pairIKiS3_EEEEEENS2_IiNS_25CustomAccessibilityActio 12 FlutterMacOS 0x0000000104a3c9cc _ZNSt3_fl10__function6__funcIZN7flutter5Shell23OnEngineUpdateSemanticsENS_13unordered_mapIiNS2_13SemanticsNodeENS_4hashIiEENS_8equal_toIiEENS_9allocatorINS_4pairIKiS5_EEEEEENS4_IiNS2_25CustomAcce 13 FlutterMacOS 0x0000000104b1c1c8 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 652
14 FlutterMacOS 0x0000000104b05ea4 FlutterEngineRunTask + 36
15 FlutterMacOS 0x00000001042acc18 -[FlutterEngine runTaskOnEmbedder:] + 56
16 FlutterMacOS 0x00000001042acdcc __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 64
17 libdispatch.dylib 0x000000019df38750 _dispatch_call_block_and_release + 32
18 libdispatch.dylib 0x000000019df3a3e8 _dispatch_client_callout + 20
19 libdispatch.dylib 0x000000019df48bb8 _dispatch_main_queue_drain + 988
20 libdispatch.dylib 0x000000019df487cc _dispatch_main_queue_callback_4CF + 44
21 CoreFoundation 0x000000019e20b4ac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
22 CoreFoundation 0x000000019e1c8c30 __CFRunLoopRun + 1996
23 CoreFoundation 0x000000019e1c7e0c CFRunLoopRunSpecific + 608
24 HIToolbox 0x00000001a8963000 RunCurrentEventLoopInMode + 292
25 HIToolbox 0x00000001a8962e3c ReceiveNextEventCommon + 648
26 HIToolbox 0x00000001a8962b94 _BlockUntilNextEventMatchingListInModeWithFilter + 76
27 AppKit 0x00000001a1a20970 _DPSNextEvent + 660
28 AppKit 0x00000001a2212dec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
29 AppKit 0x00000001a1a13cb8 -[NSApplication run] + 476
30 AppKit 0x00000001a19eaf54 NSApplicationMain + 880
31 example_text_field_enabled_crash 0x0000000100cf48e4 main + 12
32 dyld 0x000000019dd620e0 start + 2360
)
libc++abi: terminating due to uncaught exception of type NSException
Lost connection to device.
the Dart compiler exited unexpectedly.
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.19.4, on macOS 14.4 23E214 darwin-arm64, locale de-DE)
• Flutter version 3.19.4 on channel stable at /Users/user/sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 68bfaea224 (4 months ago), 2024-03-20 15:36:31 -0700
• Engine revision a5c24f538d
• Dart version 3.3.2
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/user/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b829.9-10027231)
[✓] IntelliJ IDEA Community Edition (version 2023.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 2021.1)
• IntelliJ at /Applications/IntelliJ IDEA CE_x86.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.90.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.4 23E214 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127
[✓] Network resources
• All expected network resources are available.
• No issues found!
Metadata
Metadata
Assignees
Labels
High-priority issues at the top of the work listAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Entering text in a text field or keyboard related problemsStack traces logged to the consoleCrashes that terminate the processFound to occur in 3.22Found to occur in 3.23For the attention of Text Input teamThe issue has been confirmed reproducible and is ready to work onBuilding on or for macOS specificallyIssue is closed as already fixed in a newer versionOwned by the macOS platform teamTriaged by the macOS platform team