Barcelona is really not bad at all for violent crime :)
There's some places that really are a bit unsafe but it's more out. Like La Mina, there's been some shootings there recently: https://www.lavanguardia.com/sucesos/20210908/7706383/tirote... (Though technically that's not Barcelona anymore but Sant Adria de Besos)