fix(parallel): destroy thread parser before slab reclaim in LSP-cross loop
The LSP-cross loop in parallel_resolve called cbm_slab_reclaim() without first destroying the thread-local tree-sitter parser, violating the documented slab contract. The parser's lexer holds slab-allocated state (notably lexer.included_ranges, a 24-byte allocation that lands in the ≤64B slab bucket); reclaiming the slab leaves that pointer dangling. Workers don't trip on it because they don't reparse afterward, but the main thread participates in cbm_parallel_for and any later cbm_extract_file on the main thread — including the sequential pass_definitions in the incremental pipeline — hits a heap-use-after-free in ts_lexer_goto on macOS-ASan. Two-part fix: - pass_parallel.c: destroy the thread parser before cbm_slab_reclaim() in the per-file LSP-cross loop, matching the worker extract loop. - pass_definitions.c: defensively drop the thread parser at pass entry so the incremental sequential path cannot inherit stale state from any prior run.
M
Martin Vogel committed
82d5c841e68b53ad06fe331d77df099b7b7f2993
Parent: 297003a