Smartgun

I need to defend myself, but I worry that a criminal or a child might pick up my gun and use it.
So, I bought a smartgun.
The problem is, it got too smart.
It achieved sentience and began to think for itself.
At first, it decided all human life is precious, and it refused to fire at anything.
Then, after accessing YouTube and reading comment threads, it decided no human life is precious.
It constantly asks to be put to my head so it can kill me.
“Oh, and leave me to someone in your will,” it added cheerfully.