Lucy, it's hard, and I agree you're on the right track. I also agree with the poster saying threats of violence against a child, viscerally tempting as it admittedly is if your child is being abused, are no sort of solution or example, either.
Crusts, there was a rather entertaining social media story a couple of years ago, where a young video games journalist weighed in on sexism in the industry, and was met with the unfortunately usual rape threats. Some on Facebook. So she forwarded them to their mums, who were appalled, hugely apologetic ("OMG I'll kill him! I am so sorry, I didn't raise him that way, I can't believe it!") and promised to deal with it. Very plausibly.
The point being: good mothers most unfortunately can raise young men capable of this. (And most violent men seem to have mothers convinced it's all lies, and their child incapable of it, too.) You hope, you believe, you do your best... but you don't, actually, know your child would never. Mothering isn't a quadrilateral equation and kids aren't slot machines. There are no absolutely perfect answers, and you can't put great parenting in and get a fabulous kid out, either.
What you can do is what the OP is doing: try to ensure a troubled young man isn't your own daughter's problem.