Bug: consistent crash from refcount issue when running python script

repro:

  1. download this font source: https://d.rsms.me/tmp/inter-roman-for-glyphs-bug.zip
  2. download or copy this script: 00-repair-off-by-one-curve-handles.py · GitHub
  3. open the glyphs file
  4. in the main “Font” tab, select all glyphs and run the script

version:
glyphs: 3.1.2 (3151)
python: “3.9.1 (Glyphs)” (as seen in Preferences → Addons)

[edit] Added crash report to the gist

I get a error in the macro window:

error while processing glyph ".null"
Traceback (most recent call last):
  File "00-repair-off-by-one-curve-handles.py", line 135
    main()
  File "00-repair-off-by-one-curve-handles.py", line 45, in main
    raise e
  File "00-repair-off-by-one-curve-handles.py", line 36, in main
    nrepaired_handles = process_layer(g, g.layers[master.id])
  File "00-repair-off-by-one-curve-handles.py", line 111, in process_layer
    return nrepairs
UnboundLocalError: local variable 'nrepairs' referenced before assignment

When I fix this, the script works fine?

Apologies! I filtered the “Font” tab by only glyphs that have paths. A smart filter like this: (I tend to be in this view most of the time so forgot)

(I’ve also updated the python script in the Gist to not crash when visiting glyphs w/o paths, so should be able to run it on all glyphs now)

Does it still crash the app for you? Because I never saw the full crash.

I haven’t been able to confirm yet — for some reason it is now taking an incredible amount of time to run the script (exact same script that’s in the gist above on the exact same glyphs document; I even downloaded it again to make sure my local copy wasn’t messed up.)

Video: http://d.rsms.me.s3.amazonaws.com/tmp/CleanShot%202023-04-21%20at%2009.32.09.mp4

I’m having my second computer run the script now so I can keep working on my main machine for now. I’ll post an update here once it finishes.

It finished and it didn’t crash, which I guess is good?
I did restart Glyphs since the first crashes, so maybe that process was in some funky state.
Thanks for the help and sorry I couldn’t help track the issue down!

Can you try starting Glyphs without plugins (Option+Shift)? Maybe a plugin is messing with the runtime?