Skip to content

[Bug]: iOS crash at launch: NULL function pointer inside AudioManager.refreshOutputDeviceRecovery (regression between 8.3.1 → 8.3.2) #2088

Description

@rat-moonshine

Preflight Checklist

  • I searched existing open and closed issues for duplicates.
  • I tested the latest stable Lime release or the current development branch where possible.
  • I reduced this to the smallest project or code sample that still reproduces the issue.
  • This issue describes one specific behavior, not several unrelated observations.

Problem Description

Lime 8.3.2 and current develop crash at app launch on iOS with a NULL function pointer dereference inside AudioManager.refreshOutputDeviceRecovery(). Lime 8.3.1 does not exhibit the crash. The regression appears to have landed with the introduction of the output-device-recovery code path.

Version Information

  • Lime: 8.3.2 (also reproduces on latest develop) — 8.3.1 works cleanly
  • OpenFL: develop (built with haxelib git openfl https://github.com/openfl/openfl.git develop)
  • Haxe: 4.3.6
  • hxcpp: v4.3.86 (via git tag)

Environment

  • Xcode: 26.6 (latest-stable on GitHub Actions macOS runners)
  • Device: iPad Pro 9.7-inch (iPad6,11), iOS 16.7.16 (20H392)
  • Build config: -final -Diphoneos (release), delivered via TestFlight

Minimal Reproduction

Any Lime-based iOS app built on 8.3.2 (or current develop) crashes at launch on the device above. Reverting only the Lime install to haxelib install lime 8.3.1 - everything else identical - makes the crash disappear.

Steps to Reproduce

  1. Build iOS app with Lime > 8.3.1 or "development" branch
  2. Package and install on a physical devices
  3. Crash immediately at the time of app start

Expected Behavior

Shouldn't crash

Actual Behavior

What I suspect

The crash is happening on the app's very first frame during Lime's AudioManager.init(). setupOutputDeviceRecovery reads like it's registering an iOS AVAudioSession route-change notification, and refreshOutputDeviceRecovery looks like the periodic/initial refresh that runs during setup. Somewhere in that chain, a function pointer or Objective-C callback selector is being dereferenced before it's initialized — likely a missing null-check or a device-configuration path where the recovery mechanism isn't applicable but is invoked anyway. iPad6,11 on iOS 16.7 is on the older/simulator-adjacent hardware end, which may explain why not all users hit this.

Workaround for other Lime users hitting this

Sys.command('haxelib install lime 8.3.1 --quiet --never');
Sys.command('haxelib set lime 8.3.1 --always');

Logs and Output

### Symbolicated crash trace (thread 0)

Using the dSYM from the crashing build:


lime::media::AudioManager_obj::refreshOutputDeviceRecovery()   ← NULL pointer call site
lime::media::AudioManager_obj::setupOutputDeviceRecovery()
lime::media::AudioManager_obj::init(AudioContext)
lime::_internal::backend::native::NativeApplication_obj::__construct(Application)
lime::_internal::backend::native::NativeApplication_obj::__alloc(...)
lime::app::Application_obj::__construct()
openfl::display::Application_obj::__construct()
openfl::display::Application_obj::__alloc(...)
ApplicationMain_obj::create(Dynamic)
ApplicationMain_obj::main()
__hxcpp_main
__hxcpp_lib_main
hxRunLibrary
SDL_main (Main.mm:24)
-[SDLUIKitDelegate postFinishLaunch]
SDL_UIKitRunApp


### Crash report excerpt


Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: SIGNAL 11 Segmentation fault: 11
Triggered by Thread: 0

Thread 0 crashed with ARM Thread State (64-bit):
x9: 0x0000000000000000
pc: 0x0000000000000000
esr: 0x82000006 (Instruction Abort) Translation fault

The `pc` and `x9` registers being 0 confirms it's a call through a null function pointer (likely an uninitialized C callback field). The `esr` decodes as an instruction abort with translation fault - i.e., the CPU tried to execute at address 0, which has no mapping.

Screenshots or Videos

No response

Performance, Timing or Rendering Details

No response

Additional Context

Pin Lime to 8.3.1 in your build script and re-set it after haxelib run openfl setup (which may otherwise auto-upgrade to 8.3.2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions