static void crashHandler(int sig)
fprintf(stderr, "%s\n", strsignal(sig));
exit(128 + sig);
If "crashHandler" is triggered from within malloc/realloc/free then any calls to those functions may deadlock on a malloc lock. "restoreColorSpace" can run arbitrary system code, and "exit" will lead to C++ destructors being called on global objects. Both of these could result in a malloc-related function being called.
Created attachment 18395 [details]
Sample from buildbot showing this hang occurring
I think that to call restoreColorSpace safely in the event of a crash it would need to be moved to a parent process that executes the real DRT. "_exit" can probably be used in place of "exit" to avoid the problems with that call.