Skip to content

Callback with ObjCBlock.listener crashed with EXC_BAD_ACCESS error #1017

@yanshouwang

Description

@yanshouwang

App crashed when the callback method executed with EXC_BAD_ACCESS error.

Launching lib/main.dart on iPhone 12 in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: PT2F4U6696
Xcode build done.                                           12.3s
(lldb) 2024-03-15 16:13:22.718904+0800 Runner[3232:1441346] [ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Connecting to VM Service at ws://127.0.0.1:55859/eyAmJlDrOlc=/ws
Initialized TensorFlow Lite runtime.
INFO: Initialized TensorFlow Lite runtime.
Created TensorFlow Lite XNNPACK delegate for CPU.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
[PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x283de1450> accessor:<<PAApplication 0x283df2c10 identifierType:auditToken identifier:{pid:3232, version:8201}>> identifier:B3419EA5-9019-4910-A61D-955CE4F35F9D kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 226 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 226 named com.apple.privacyaccountingd}
* thread #9, name = 'io.flutter.1.ui', stop reason = EXC_BAD_ACCESS (code=1, address=0x166f994f0)
    frame #0: 0x00000001b85e7a7c libobjc.A.dylib`objc_retain + 16
libobjc.A.dylib`objc_retain:
->  0x1b85e7a7c <+16>: ldr    x17, [x17, #0x20]
    0x1b85e7a80 <+20>: tbz    w17, #0x2, 0x1b85e7a38    ; ___lldb_unnamed_symbol1366
    0x1b85e7a84 <+24>: tbz    w16, #0x0, 0x1b85e7a60    ; ___lldb_unnamed_symbol1366 + 40
    0x1b85e7a88 <+28>: lsr    x17, x16, #55
Target 0: (Runner) stopped.
Lost connection to device.

Exited.

Related code:

  @override
  Future<List<Barcode>> process(InputImage image) {
    final completer = Completer<List<Barcode>>();
    final mlkImage = image is BitmapInputImageImpl
        ? image.toMLKVisionImage()
        : throw TypeError();
    final completion = ffi.ObjCBlock_ffiVoid_NSArray_NSError.listener(
      lib,
      (nsBarcodes, nsError) {
        final barcodes = nsBarcodes?.toBarcodeList() ?? [];
        final error = nsError?.toError();
        if (error == null) {
          completer.complete(barcodes);
        } else {
          completer.completeError(error);
        }
      },
    );
    mlkScanner.processImage_completion_(mlkImage, completion);
    return completer.future;
  }

The source repo is here: https://github.com/yanshouwang/hymir.dev/tree/hymir_mlkit/hymir_mlkit/hymir_mlkit_darwin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions