Having said that, all guns in California are sold with a state approved lock. As a gun owner it's not necessary to lock it but,,, if a child gets hold of it your ass is toast. It's all about child safety laws. Without a child around it's a mute point.
So,,,, if you're on your boat by yourself it's not necessary to have your gun locked. At least in California.