When you say dissolve, you really mean react. Yes, The ions play an important role. In the case of HF, F- reacts with silica in glass to produce silicon fluorides. Silica won't react with other usual ions.
Basically it depends on how reactive an element is with an ion.
In the case of copper, it is quite resistant to HCl acid because Cu is pretty stable in the zero oxidation state and Cl- is not a good oxidizer. But copper will react with HNO3 because nitric (NO3) can oxidize copper to Cu+2.
On the other hand, zinc can easily react with HCl and get oxidized not by Cl-, but by H+, because Zn is much more easily oxidized than Cu.