Glyphs 3 crashes from bad memory access when running macro script

Glyphs crashes almost every time I run a script that modifies kerning. It crashes from SIGSEGV in python’s visit_decref called during garbage collection (so, sounds like non-python data is in a dict and is being “double freed”.) Full crash log in the zip:

glyphs-crash-script.zip (4.2 MB)

Repro:

  • open the two fonts in the zip
  • make the italic one the active font
  • visit each master in the UI (there’s a bug where the italicAngle is zero in the API until a master has been viewed in the UI)
  • run the script

Versions:

  • Glyphs 3.1 (3133)
  • Python used: “3.9.1 (Glyphs)”
  • macOS 10.15.7

Can you try the latest version, should be build 3140.

In 3.1-3133 I get this but no crash:

roman_font /Users/georg/Downloads/glyphs-crash-script/Inter-Roman.glyphspackage
ital_font  /Users/georg/Downloads/glyphs-crash-script/Inter-Italic.glyphspackage
master mapping:
  Thin            -> Thin Italic
  Display Thin    -> Display Thin Italic
  Regular         -> Italic
  Display         -> Display Italic
  Black           -> Black Italic
  Display Black   -> Display Black Italic
Done

Confirmed to be fixed and works as expected in Glyphs 3.1.2 (3151)
Thank you!