Skip to content

[macOS][desktop]: Deleting emojis from textfield with obscured text causes crash #122381

@AdamVe

Description

@AdamVe

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. focus the text field -> cursor is blinking in the text field
  3. write an emoji
    a. Open the Emoji & symbols popup
    image
    b. Select an emoji and click it
    image
    c. the text field now contains 2 obscuring characters and blinking cursor after them
  4. press back-space key to delete from the

Expected results: the characters are deleted from the text field

Actual results: app crashes

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        home: Scaffold(body: TextField(obscureText: true)));
  }
}
Crash log
2023-03-10 09:45:11.420 flutter_testing[38778:1183562] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid JSON message, decoding failed'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001a37b43e8 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001a32feea8 objc_exception_throw + 60
	2   Foundation                          0x00000001a46f7910 -[NSCalendarDate initWithCoder:] + 0
	3   FlutterMacOS                        0x0000000107e3c51c -[FlutterJSONMessageCodec decode:] + 540
	4   FlutterMacOS                        0x0000000107e3cc54 -[FlutterJSONMethodCodec decodeMethodCall:] + 112
	5   FlutterMacOS                        0x0000000107e3a670 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 80
	6   FlutterMacOS                        0x00000001071821dc -[FlutterEngine engineCallbackOnPlatformMessage:] + 424
	7   FlutterMacOS                        0x0000000107a58bb0 _ZNSt21_LIBCPP_ABI_NAMESPACE10__function6__funcIZ23FlutterEngineInitializeE4$_30NS_9allocatorIS2_EEFvNS_10unique_ptrIN7flutter15PlatformMessageENS_14default_deleteIS7_EEEEEEclEOSA_ + 132
	8   FlutterMacOS                        0x0000000107a683f4 _ZN7flutter20PlatformViewEmbedder21HandlePlatformMessageENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE + 76
	9   FlutterMacOS                        0x0000000107a68e54 _ZNSt21_LIBCPP_ABI_NAMESPACE10__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter20PlatformViewEmbedder30EmbedderPlatformMessageHandler21HandlePlatformMessageENS_10unique_ptrINS5_15PlatformMessageENS_14default_deleteIS9_EEEEEUlvE_EENS_9allocatorISE_EEFvvEEclEv + 80
	10  FlutterMacOS                        0x0000000107a65568 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 616
	11  FlutterMacOS                        0x0000000107a4d50c FlutterEngineRunTask + 48
	12  FlutterMacOS                        0x00000001071844d4 -[FlutterEngine runTaskOnEmbedder:] + 56
	13  FlutterMacOS                        0x0000000107184690 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 64
	14  libdispatch.dylib                   0x00000001a34d09dc _dispatch_call_block_and_release + 32
	15  libdispatch.dylib                   0x00000001a34d2504 _dispatch_client_callout + 20
	16  libdispatch.dylib                   0x00000001a34e0d1c _dispatch_main_queue_drain + 928
	17  libdispatch.dylib                   0x00000001a34e096c _dispatch_main_queue_callback_4CF + 44
	18  CoreFoundation                      0x00000001a377ad40 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
	19  CoreFoundation                      0x00000001a37387c0 __CFRunLoopRun + 2036
	20  CoreFoundation                      0x00000001a3737878 CFRunLoopRunSpecific + 612
	21  HIToolbox                           0x00000001ace17fa0 RunCurrentEventLoopInMode + 292
	22  HIToolbox                           0x00000001ace17de4 ReceiveNextEventCommon + 672
	23  HIToolbox                           0x00000001ace17b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
	24  AppKit                              0x00000001a69bd84c _DPSNextEvent + 632
	25  AppKit                              0x00000001a69bc9dc -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
	26  AppKit                              0x00000001a69b0e0c -[NSApplication run] + 464
	27  AppKit                              0x00000001a6988250 NSApplicationMain + 880
	28  flutter_testing                     0x00000001043df958 main + 12
	29  dyld                                0x00000001a332fe50 start + 2544
)
libc++abi: terminating with uncaught exception of type NSException
Lost connection to device.
Reproduced on
[✓] Flutter (Channel main, 3.9.0-1.0.pre.145, on macOS 13.2.1 22D68 darwin-arm64, locale en-SE)
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-arm64, locale en-SE)

Cannot reproduce on Android.

Screen recording showing the issue
delete-emoji-crash.mp4

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processengineflutter/engine related. See also e: labels.found in release: 3.7Found to occur in 3.7found in release: 3.9Found to occur in 3.9has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyr: 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