Sliding Glass Door Locked from the Outside?
The latch mechanism ("hook deadlock" as mentioned by CactusCake) is generally installed so that the "hook" is facing up. But sometimes people install them upside down to where the hook faces down and if it is loose and sloppy, the hook falls down when you shut the door, locking you out.

Normal:


Upside down: