This could be a sign of hardware failure. I recommend you back up any critical data immediately. Are there any errors seen Device Manager? What about Event Viewer just moments before the system locks up? Tell us about your system, including how much RAM and free disk space.
It seems to happen randomly when I change focus from one application to another.
As soon as you start your computer? Or only after it has fully warmed up? What if you start your computer, then walk away - will it lock up? 50°C is fine for the CPU, but heat is the bane of
all electronics so you need to make sure your graphics card, drives, RAM, PSU, and motherboard are all adequately ventilated too. Make sure the system is clean of heat trapping dust and dirt. If already clean, try blasting a desk fan in there to see if it happens.
While in there, inspect the motherboard for bulging or leaking electrolytic capacitors. These failed or failing capacitors are a common cause of sudden, but seemingly random system lock ups and reboots. The capacitors look like tall soda cans, many of which surround the CPU socket.
A stressed PSU can cause sudden lock ups. Has hardware been added to the computer since the PSU was new? How old is it? A failing PSU can cause all sorts of strange, seemingly random problems. There are testers available, or most shops will test for a small fee, or you can just swap in a known good PSU of
adequate power - essential for today's power hungry graphics cards.
I would test the RAM too. You can use one of the following programs. Both require you to create and boot to a bootable floppy disk or CD to run the diagnostics. Using the floppy method is generally easier and yet another reason I still include floppy drives in my new PC builds. However, the CD method is just as effective at detecting RAM problems. Allow the diagnostics to run for several passes or even overnight. You should have
no reported errors.
Windows Memory Diagnostic - see the easy to follow instructions under Quick Start Information.
or
MemTest86+ (for more advanced users) - an excellent how-to guide is available here.