It is up to the applications to decide what to do when the X server quits.
Session management is a hard task - remember that the processes are organized into a tree, and that the "session manager" is not necessarily at the top of the tree (at a minimum it is one level down, and there is one or more sibling trees involved). That means that terminating a session SHOULD be done by telling the "session manager" you want to log out. The session manager can then send an event to known processes that want such an event, then they wait for a reply. After a timeout, the session manager may then terminate - and terminate the X server. Many such processes now (gnome anyway) use Dbus for such notifications. If the application doesn't use dbus, then it cannot register with the session manager, OR request notification of a logout request.
Note - all of the above is strictly voluntary. If the X server terminates (or is terminated), no such voluntary event message is ever sent, nor is a response waited for. It is up to the application to choose what to do when the socket connection is closed. Well written applications will catch such events, and make suitable arrangements about terminating. Unfortunately, not all of them do; nor do they all even exit (they seem to keep trying to reconnect...)
Last edited by jpollard; 08-09-2013 at 12:08 PM.