When the Desktop::~Desktop singleton is destroyed , it re-enables the screensaver. (setScreenSaverEnabled(true)). If it was previously set to false, it causes the XWindowSystem singleton to be re-created , which leads the DeletedAtShutdown class to jassert , and then (sometimes) a crash indicating memory corruption.
(Btw I think the setScreenSaverEnabled is useless on linux, it uses an api specific to xscreensaver only, which I think nobody uses anymore, so maybe the simplest think is just to remove it).