I'm assuming we're talking about a toddler here, not an older child that is able to open the doors.
My car has remote central locking so it's not actually possible to lock yourself out of the car, although there's a "lock all doors" button which I guess could lock the child in if I'd left my keys in the car and they pressed it... but (a) I wouldn't be leaving my keys in the car with a child and (b) I wouldn't be leaving a child alone in there in the first place
If your windows are aftermarket tinted then smashing them should be a lot safer, since the film will stop the glass flying everywhere.