16 Commits

Author SHA1 Message Date
Ivan FB
2e30f06757
fix: reject {.ffi.} calls on an unconstructed ref library
When no {.ffiCtor.} has stored a library, the FFI thread points `myLib` at a
default-valued fallback so handlers always have something to bind, and
`myLibOwned` is what distinguishes that fallback from a real one. For an
`object` library the fallback is a usable zero value and callers legitimately
depend on it, but for a `ref` library it is `nil`: the user body received a nil
ref and faulted on its first field access. A failing ctor is the common way to
get there, since the C entry point hands back a live context before the ctor
body has run on the FFI thread.

Guard on `myLibOwned` for `ref` library types only. The check sits in the
generated handler rather than the C entry point, so it runs behind any queued
constructor — a host that fires a call without awaiting the create callback
still succeeds, as before.

Backport of the same fix on master, where the state had to be added rather than
reused.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULz7Md52AF6PmqZeCmh8b7
2026-07-28 02:44:09 +02:00
Gabriel Cruz
f6881274ca
feat(ffi): cwire codec composite fields (#88) 2026-06-23 12:55:07 -03:00
Gabriel Cruz
6c4657ad7e
feat(ffi): cwire codec core (flat scalars + strings) (#87) 2026-06-23 11:49:19 -03:00
Gabriel Cruz
a5ccadd62d
feat(ffi): per-interaction ABI-format annotations + c codec (ffiRaw) (#85) 2026-06-23 11:18:03 -03:00
Gabriel Cruz
021f469041
feat: {.ffiHandle.} — export complex live objects as opaque handles (#81) 2026-06-16 14:11:31 -03:00
Gabriel Cruz
16dc1b3573
chore(ci): add nph linting (#77) 2026-06-10 16:30:30 -03:00
Gabriel Cruz
9b3cde7674
feat: move user event code to a dedicated event thread (#69) 2026-06-09 11:35:04 -03:00
Gabriel Cruz
54c41a3e62
refactor(ffi): event thread scaffolding + FFIContext lifecycle split (#71) 2026-06-08 11:46:16 -03:00
Ivan FB
f96a5b158a
Remove wildcard event listener; keep per-event dispatch (#70) 2026-06-02 22:22:35 +02:00
Ivan FB
496a341466
Event registry wiring (#49) 2026-05-27 22:26:39 +02:00
Ivan FB
e99220a3e4
fix use-after-free concern (#47)
Co-authored-by: Gabriel Cruz <8129788+gmelodie@users.noreply.github.com>
2026-05-26 23:46:27 +02:00
Gabriel Cruz
e43c1e03e8
tests: cover gaps in CBOR type coverage (#41) 2026-05-26 17:10:42 -03:00
Ivan FB
216316826c
add FFIEventRegistry: multi-listener data structure for FFI events (#45) 2026-05-26 21:42:01 +02:00
Ivan FB
6a7e4616fd
Adjust events to cbor (#39) 2026-05-25 15:51:56 +02:00
Gabriel Cruz
ee472f05ad
chore(ci): fsanitize tests (#34) 2026-05-20 14:14:42 -03:00
Ivan FB
584e818ac9
Add basic cpp e2e tests (#27) 2026-05-19 12:43:34 +02:00