I've looked at this a lot, both when handling firearms and when driving. It's all about maintaining the focus of attention. Of course, I'm prone to doing stupid things, and that has been seriously noted. The known cure is to focus attention, and prioritize the most important thing. Ignoring the non-important is equally as essential. I almost rear-ended a car a short time ago because I allowed my mind to wander from the most important thing.
Whenever I handle one of my Glocks, I consciously keep the trigger area free of fingers and any object. That's hallowed ground. I've trained myself to keep the chamber clear. If I have to draw the gun, my free hand first racks the slide and then braces for the shot. It takes longer to get the first round fired, but that first round would probably have been fired short anyway.
When I put a Glock away, I clear it, and dry fire it. There is always a correct procedure, and anyone who has worked with procedure knows that no step can be performed out of sequence, whether you're clearing a firearm, baking a cake, or repairing a nuclear submarine.
That is the long way of saying that one either maintains the personal discipline to remain qualified to handle firearms, or one is just plain too stupid to deal with life. It's fine with me that those who prove to be that stupid with firearms are self canceling.