bitcoin/bitcoin — pull request #1439 by Diapolo (2012-06-11 05:51:00+00:00)
Title: re-work Shutdown() function

This pull is based on a discussion with @TheBlueMatt and @laanwj.

- introduce a new Shutdown() function, which calls FinishShutdown() if no GUI is used (== old Shutdown() function) and uiInterface.QueueShutdown() if a GUI is used
- all direct uiInterface.QueueShutdown() calls are replaced with Shutdown() - this ensures a clean GUI shutdown, even when catching a SIGTERM and allows the BitcoinGUI destructor to get called (which fixes a tray-icon issue)

The current implementation (current master branch) sometimes crashes Bitcoin-Qt (bad) and doesn't allow GUI object destructors do their work as we call exit() in Shutdown(), which leads to an unremoved tray-icon (as visible bug).

I'm sure we could remove some ``#include "ui_interface.h"`` in the modified files, but I was not really sure about that, so input is welcome.