People being regular-shitty, combined with context, like making comments about the appearance and intelligence of the only other woman in the office, can create an inhospitable environment that forces women out. Companies that wish to hire and retain women should proactively create a hospitable environment or situations like above will occur.
The bigger thing is that it seems like you don't see return on investment into creating these better environments. Do you feel that diversity initiatives are wholly unnecessary or just poorly designed/targeted?