If emacs loses its connection to the X server, either by shutting down the server or giving the emacs window a "XKillClient", it will dump core. This occurs because emacs tries to clean up, but ends up overflowing the communication buffer to the X server. I will submit a sample patch.
patch added for next release.