A young man I knew died the same way.
He had one of those earlier S&W autoloaders with a firing pin block safety on the slide. It had an additional safety near the grip.
He used to chamber a round, take the grip safety off, point it at people, and pull the trigger, as a joke. Because the firing pin block safety prevented the pistol from firing he thought people’s reactions were funny.
He eventually got the idea that the people he was pointing the pistol at did not find any humor in his actions so he modified his clown routine.
He would point the pistol at his head and pull the trigger.
He did this one day at the gun store he worked. He explained the safeties to a man across the counter, handed the man his gun, took it back. He loaded it, pointed the muzzle at his head, and pulled the trigger.
Unfortunately he did not notice that the customer had moved the firing pin block safety.
I knew this guy, went hunting with him, he was a decent person, and I wish he had not killed himself.