There are many scripts, such as the publicly available Kern Crasher that have a long runtime, particularly if they are run on a large character set. Once the script is started, it is not possible to stop it as the UI (which uses vanilla) freezes. The only option is to either wait until it has finished or to kill the Glyphs process.
I’ve been trying to implement a “Cancel” button for such a script, but haven’t been able to get it to work. Based on the examples here I have tried running the processor intensive code in a new thread, but the GUI still freezes when processing and the Cancel button is only polled at the end.
I have also tried opening the GUI window in its own thread, but this caused Glyphs to crash and I have been since informed that GUI code should always be in the main thread.
Can anyone with more experience in multithreading and vanilla help me here? Perhaps this problem has been solved already?
Thanks in advance!