Have you talked with her about your marriage? Is she happy in it? We don't usually get emotionally attached to others unless we're emotionally detached from the one we're with. Maybe there's an area in your relationship that needs to be looked at. What's lacking, apart from trust?
As for your question, I suppose it would be to establish boundaries. What are and aren't you comfortable with? How was she behaving with the husband that crossed the line with you?