I'd also add that there's something called "Blank-fire Non-Guns" which are built-as-prop "guns". As someone above mentioned, blank-firing guns aren't "safe", and that not only because of the examples cited; a blank generates enough power to cycle the gun, and while no projectile is launched there's still a very powerful muzzle blast. (There was an incident (and probably others) were an actor from a TV show was messing around with a blank-firing gun and shot himself in the head with it as a "joke"; the muzzle blast caused brain death.)
Point in case, in scenes were people are getting shot point blank (suicides, execution -style shot to the back of the head, etc) you can't use a blank firing gun. So they use these so-called blank-firing non-guns, which actually have a mag (and special blank rounds similar to the 22LR blanks they use in nailguns), moving slide, etc. however the barrel doesn't have a bore by design (except for the muzzle, for looks). The entire contraption is designed to vent the gas upwards through the ejection port (if you look for it you can sometimes catch it, specially in older movies or when there's no budget for CG cleanup of a detail like that).
Combined with a squib and the right camera angle, you get a functional looking pistol (or whatever gun), cycling action, a flash of unidentifyable flying brass and blood and brain matter splashed against the wall. Yay!