Happens constantly to me. No matter what machine I'm on...
I do a lot of changes in the system preferences, and it's a hit or miss on whether or not I'll be locked or not. I usually just stay logged out when I don't want my users touching my computer.
I've reported this to apple feedback, and encourage others with the same problem to do so as well.