Thank you for sharing an embarassing experience. You may very well have saved someone from a tragedy. I have a two and a half year old daughter, and I just took a vow to be safer, so your story has already made a difference.
The other day I had an "accidental discharge" at home.
I was changing clothes in the computer room, getting ready for bed. (My wife has completely taken over the bedroom closets so my clothes are kept in an extra bedroom we have converted into a computer room/study.) I set my Kel Tec P3AT on the desk, pull my shirt off, and turn to grab my bathrobe.
At that precise moment, my daughter walks in, picks up the handgun, and lets go with one round into the ceiling. Major panic for all concerned.
So, lesson #1: All guns must be secured if they are going to be out of your direct control even for a second. (I now have a pistol safe sitting on top of the computer next to the desk in addition to the nightstand pistol safe.)
Lesson #2: With young children (my daughter is 4), some lessons "stick" and others may not. The lessons that had not stuck were "don't touch unless you ask daddy first" and "no finger on the trigger unless you're ready and planning to shoot." However, "always point the gun in a safe direction" did stick. Even after the gun fired, she held it pointed in a safe direction.
Lesson #3: Without hearing protection, those things are loud.
Lesson #4: Repairing a hole in the roof cost $70.
In the end, nobody was hurt, no serious damage was done, and lessons learned all around.
You put a loaded pistol in reach of your 4 year old?
You're *glad* she kept the muzzle in a "safe direction" after firing it?
I can only recomend that you get rid of ALL firearms in your home.