This leads to the bitcoin core being shut down while the UI is accessing it, and generally results in a segmentation fault or crash. In case it is desirable to make it possible to shutdown the GUI from its RPC server, we'll need to implement a signal for it. For the mean time, this is a safe stopgap.
Reproducing the bug:
bitcoin-qt -testnet -server -datadir=<new directory>
Output:
Warning: To use the "-server" option, you must set rpcpassword=<password>
in the configuration file: /tmp/test/testnet/bitcoin.conf
If the file does not exist, create it with owner-readable-only file permissions.
Segmentation fault
Also changes the Warning to an Error (as it is kind of fatal, terminating the rpc thread).