Glyphs freezes while typing in Script UI

Glyphs freezes with a beachball cursor when I type in script UI.

Testcase:

  1. Create a new font with 2 components as _part.a _part.b (I just placed some boxes in them)
  2. Place component _part.a in the glyph A and select the glyph.
  3. Start Mekkablues script “Replace Components”
  4. Select component to replace
  5. Type the name of component _part.b (I noticed this problem often, when I typed beyond the size of the text field)
    → Glyphs freezes with a beachball cursor

I run the latest Beta Version 2.6.1 (1225) and already updated the python modules and removed all scripts but “Replace Components”. In some of my own scripts I had this behaviour, too.

Strangely I can reproduce this problem with builds 1192 and 1223, too.

Here is the debug report:

debug info.txt.zip (215.8 KB)

@mekkablue I think I found something:

In the “Replace Components” script:

Line 35:
self.w.componentNewName = vanilla.EditText((65+80+40+30, 12, -120, 19), "glyph.alt", sizeStyle='small', callback=self.SavePrefs)

Here inside the callback self.SavePrefs is called on each keypress.

Line 96:
Glyphs.defaults["com.mekkablue.ReplaceComponents.newCompName"] = self.w.componentNewName.get()

Here in the callback gets the componentNewName and saves it in the preferences.
When I comment out this line, the freeze is gone!

Maybe there is a problem getting the name in the callback while it is modified via vanilla.EditText?
Feels like some kind of race condition that’s only affected while fast typing in the text field.

Hmm. Cannot reproduce.

It is very strange. The error appeared after I finished my last script with the LSB root anchors. I noticed several scripts causing this freeze. Even older versions of Glyphs now had this problem despite working flawlessly all the time before I updated Glyphs to 1225. Maybe it has something to do with the python installation on my machine? I completely removed and reinstalled Glyphs. But the the freeze is still there.

Yes, that might be it. There’s a bug in the Python API in 1225, perhaps this is also an effect of it.

The python API in one version can’t changed the behaviour on another. It is not installing anything. I suspect something else, like an updated plugin. Can you try to start without plugins by holding down Opt+Shift?

It still freezes without plugins.

The last line in this stack trace could be a hint:

11 -[CFPrefsSource copyValueForKey:] + 28 (CoreFoundation + 192734) [0x7fff475f80de] 1-11
11 __ulock_wait + 10 (libsystem_kernel.dylib + 14814) [0x7fff73bae9de] 1-11
*11 ??? (kernel + 7316080) [0xffffff80008fa270] (blocked by unfair lock owned by Glyphs [7785] thread 0x60b32) 1-11

This is not helping. You run into some kind of infinite loop or dead lock. But what is causing it is not clear.

I have another idea. When you start the first script after program launch you have to wait for a few seconds with the beach ball cursor active. I assume at this point the Python Wrapper is loaded.

Does it stay loaded when you quit Glyphs and start an older version of Glyphs? Maybe this could explain that this problem happens for older versions, too.

One additional thing I noticed: Glyphs freezes after being idle for a longer duration. I try to reproduce it with and without the loaded wrapper to see if there is something correlated.

No, each app has to load the wrapper again.

Sorry that I’m wildly guessing :wink: