What to do when the desktop freezes?

Update 2018-Apr-15

As of Linux Mint 18 there has been a move to LightDM display manager, which you can restart as follows:

sudo service lightdm restart


Running reboot is a perfectly safe way of doing it. If you just wanted to log out (restart your GUI session), you could run:

sudo service mdm restart

That will restart the Mint Display Manager, the default display manager under Mint.

When you are able to do CTRLALTF1, after you can try to kill the offending software. (via pgrep, pkill...). Not always, but often, it is enough to gain back the control of the graphical environment and to log-out normally after a CTRLALTF7

If you cannot do it usually with CTRLALTBACKSPACE you can restart the graphic server.

On Ubuntu you should give command as sudo service lightdm restart after the CTRLALTF1, I think you can find easily the analogous for Mint.

The reboot is the last resource, and it will close as well as it can all the processes still running and responding.

You can run sudo pkill Xorg, that will kill the X11 server which will then restart for a login prompt.

This methods is simpler, easier to remember, and more generic than restarting the underlying service. The service might change depending on the Linux distribution, release or graphic environment selected but the X server name is much more stable; it didn't change since a decade.

Should you want to recover an unsaved work in progress, instead of killing the X server which will immediately kill all X clients (applications), you might identify the bogus program that froze your desktop, commonly either an application or desktop component that grabbed the mouse and kept it, and kill or restart that precise component. With Mint 17.2 and the Mate desktop, this often happens to me with mate-panel.