Fix a spurious segfault on Windows.
This one is critical. The segfault happens inside glob_quit() when running gui-less (-nogui). It bothers me every time I test some changes to the Windows version and run regression_tests.pd gui-less as a quick check that the basic functionality still works. Which is its purpose after all. :) But with the regression test making pd.exe segfault, it becomes useless. It doesn't happen every time, but quite often.
Of course, our CI script also uses this regression test and suffers from the same defect. You can actually see this in many logs of the windows_i386_innosetup runner. Here is a typical example taken straight from the log of one of my recent builds:
Testing Purr Data for Windows $ cd scripts $ ../packages/win32_inno/build/bin/pd.com -noprefs -nogui -noaudio -send "init dollarzero \$0" regression_tests.pd $ ../packages/win32_inno/build/bin/pd.com -noprefs -nostdpath -nogui -noaudio external-tests.pd
Note that there is no output from regression_tests.pd at all. This is a tell-tale sign of the segfault. Normally it should print something like this:
unpost_print: testing unpost... test message unpost_print: testing unpost error... test message warning: hex2dec: realtime unsafe memory allocation for lists with more than 10 elements Done: all tests succeeded. closing audio... closing MIDI... ... done.
The easy fix is to just bypass the gui finalization code in glob_quit() when running gui-less (sys_nogui). This completely eradicates the segfault for me, and running regression_tests.pd works every time.