Glyphs 4.2 (4205) crashes during File → Export: race in `GSGlyph addLinkedGlyph:` from `doAlignComponents`

Glyphs 4.2 (4205) on macOS 27.2 (26B123) crashes repeatedly during font export. It happens with a plain File → Export, with no script involved. The same crash also occurs when the same file is exported through instance.generate() from a script.

Steps

  1. Open [file / short description: e.g. “a 3-axis family (opsz, wght, slnt) with N masters and many automatically aligned components”].
  2. File → Export → [format, e.g. OTF / Variable Fonts], [settings: remove overlap, autohint, …].
  3. Glyphs quits partway through the export. It doesn’t happen every time [how often: e.g. “about every second/third export”].

Crashing thread (File → Export, 2026-11-21 11:01)

CoreFoundation   __exceptionPreprocess
libobjc.A.dylib  objc_exception_throw
Foundation       -[NSConcreteHashTable rehash]
Foundation       hashProbe
Foundation       -[NSConcreteHashTable addObject:]
GlyphsCore       -[GSGlyph addLinkedGlyph:]
GlyphsCore       -[GSComponent _updateObservation]
GlyphsCore       -[GSComponent updateComponentGlyph:]
GlyphsCore       -[GSComponent component]
GlyphsCore       -[GSComponent componentLayer]
GlyphsCore       +[GSLayer(AlignComponents) _alignComponent:componentIdx:currAnchors:…]
GlyphsCore       -[GSLayer(AlignComponents) doAlignComponents]
OTF              ???
OTF              ???
GlyphsCore       __57-[NSArray(Helpers) enumerateObjectsInParallelUsingBlock:]_block_invoke
libdispatch      _dispatch_worker_thread2

The main thread is idle in -[NSApplication run]. Nothing from Python or PyObjC is on any thread.

Other threads at the moment of the crash

Eight NSOperationQueue threads are in -[GSFont(PrepareExport) generateInstance:error:] at the same time, interpolating. Five of them are inside the same registration call, waiting on the lock:

GlyphsCore  -[GSReadWriteLock lockWrite]
GlyphsCore  -[GSGlyph addLinkedGlyph:]
GlyphsCore  -[GSComponent _updateObservation]
GlyphsCore  -[GSComponent updateComponentGlyph:]
GlyphsCore  -[GSComponent component]
GlyphsCore  -[GSGlyph(Interpolation) _interpolateLayers:interpolation:scale:masters:decompose:font:error:]
GlyphsCore  -[GSGlyph(Interpolation) interpolateFull:…]
GlyphsCore  -[GSFont(PrepareExport) _interGlyph:instance:scale:masterID:missingGlyphs:]
GlyphsCore  -[GSFont(PrepareExport) _generateInstance:error:]
GlyphsCore  -[GSFont(PrepareExport) generateInstance:error:]

Several other worker threads are in -[GSLayer flattenOutlinesRemoveOverlap:…] inside enumerateObjectsInParallelUsingBlock:.

So the interpolation path takes GSReadWriteLock lockWrite before addLinkedGlyph:. The crashing doAlignComponents path reaches -[NSConcreteHashTable addObject:] on the same kind of link table, and the table is corrupted mid-rehash. Either the alignment path doesn’t take the same lock, or it holds a different lock from the one guarding that glyph’s linked-glyph table.

Same crash from scripted export

The same file crashes the same way when exported with instance.generate(…) from the Macro window (2026-11-20, three crash reports). The stack is the same, except that the parallel block is entered from PyObjCFFI_Caller instead of the operation queue. In one of those reports the corruption shows up as heap damage instead of the exception:

libsystem_malloc _xzm_xzone_malloc_freelist_outlined   ← "BUG IN CLIENT OF LIBMALLOC: memory corruption of free block"
libobjc.A.dylib  grow_refs_and_insert(weak_entry_t*, objc_object**)
libobjc.A.dylib  weak_register_no_lock
libobjc.A.dylib  objc_storeWeak
GlyphsCore       -[GSComponent updateComponentGlyph:]
GlyphsCore       -[GSComponent component]
GlyphsCore       -[GSComponent componentLayer]
GlyphsCore       +[GSLayer(AlignComponents) _alignComponent:…]
GlyphsCore       -[GSLayer(AlignComponents) doAlignComponents]

Question

Is there anything I can do in the meantime, for example a setting to export instances one after another instead of in parallel? I can send the full .ips files privately.