Skip to content

AU: re-initialize when a restored ClassInfo arrives; rtrb 0.3.5 - #24

Merged
unohee merged 5 commits into
masterfrom
fix/au-classinfo-reinit
Oct 25, 2026
Merged

unohee merged 5 commits into
masterfrom
fix/au-classinfo-reinit

Conversation

@unohee

@unohee unohee commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Logic initializes an AU and then restores its ClassInfo. The restored state arrived after initialization, so a non-automatable choice made at load time, such as de-leak's Low latency mode, was not applied after reopening a project.

  • set_class_info now re-initializes the plug-in right away, behind a render gate (plugin_gate: idle / rendering / reinit). Render outputs silence while the gate is held. A restore waits up to 250 ms for an in-flight render, then falls back to re-initializing on the next Reset (f0742d3).
  • standalone: rtrb 0.3.5 (RUSTSEC-2026-0274).

Pinned in de-leak-rt as 7e839ec5 (Intrect-io/de-leak-rt#55). Checked in Logic Pro: Low applies after reopening, and real-time and offline bounces are bit-identical. REAPER and Live: no change.

Logic Pro initializes an AudioUnit and restores its saved ClassInfo
afterwards. VST3 and CLAP re-run initialize() inside their state setters,
but the AU wrapper only deserialized the parameters, so a plug-in that
reads its state in initialize() (latency mode, engine choice) kept the
defaults for the whole session.

set_class_info is not serialised against render, so it now only flags the
unit; the next Reset (serialised, main thread) runs the initialize body
again, including the latency update and its notification. A failed
re-initialization leaves the unit uninitialized, like a failed Initialize.
Reset alone was too late: Logic restores ClassInfo at project load but
calls Reset only around a bounce, so ordinary playback kept the state
read before the restore (the first bounce too).

set_class_info now re-initializes immediately behind a gate that render
takes for each slice: a render that finds the gate held by the restore
outputs silence instead of touching the plug-in, and a restore that
finds a render in flight waits up to 250 ms before leaving the work to
the next Reset.
rtrb 0.2.3 has a double free / use-after-free in ReadChunk::commit when an
element's Drop panics. The standalone backend only uses RingBuffer::new,
push and pop, which 0.3 keeps.
auval, and Logic's validation which runs it, sets MaximumFramesPerSlice on
the main thread and checks its listener right after the call returns:
"Changing max frames property did not fire off a property changed
notification". Since e49332f every notification waited for the 100 Hz
run-loop timer. SetProperty now drains pending notifications before it
returns when it runs on the main thread; other threads keep the timer. The
wrapper borrow ends before the drain, so a listener that disposes the AU
leaves nothing pointing into it.
master serialises AU lifecycle and render with processing_gate (AUD-2067) and
notifies set_property listeners on the calling thread (bd819ab), which
supersedes 565340d's main-thread-only drain. The ClassInfo re-initialization
from f0742d3/2e7fe863 now runs under processing_gate instead of its own
plugin_gate: set_class_info takes the gate (waiting out an in-flight render)
and re-initializes; re-entered on the gate-holding thread it defers to the
next Reset. restored_class_info_reinitializes_the_plugin fails without the
re-initialization and passes with it; 159 lib tests pass.
@unohee

unohee commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator Author

Resolved the conflict with master. master's processing_gate (AUD-2067) and calling-thread set_property notifications (bd819ab) supersede this branch's plugin_gate and 565340d's main-thread-only drain. The ClassInfo re-initialization now runs under processing_gate: set_class_info takes the gate, which waits out a render in flight. Re-entered on the gate-holding thread, it defers to the next Reset. restored_class_info_reinitializes_the_plugin was checked red/green; 159 lib tests and the full CI matrix pass. Merging with a merge commit so de-leak-rt's v0.2.0 pin 565340d stays in master's history.

@unohee
unohee merged commit e39670f into master Oct 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant