escaping-tap-regression

command
v0.6.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

escaping-tap-regression demonstrates the original use-after-free that motivated applegen's escaping-block classifier (appledocs c09228c541).

AVAudioNode.InstallTapOnBusBufferSizeFormatBlock is the raw generated wrapper for installTapOnBus:bufferSize:format:block:. The audio engine holds the tap block past the call's return and invokes it on the audio I/O thread, so the pre-fix generator's `defer _block.Release()` was a use-after-free. AVAudioEngine does not synchronously [block copy] — release-before-copy meant the audio thread later saw a freed Go closure wrapper and crashed with EXC_BAD_ACCESS / SIGTRAP.

The safe public API is the avfaudio.InstallTapOnBus helper, which manages the block lifetime explicitly via a release token. This example uses the raw method on purpose, to exercise the previously-buggy generator path.

Run:

go run .

Requires microphone permission. Build into a code-signed .app bundle (e.g. with tmc/macgo) or grant Terminal mic access in System Settings > Privacy & Security > Microphone. Exits 0 once at least one tap callback fires.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL