Not fully sure why it crashes but it's on this line:
QModelIndex contactIndex = m_proxyModel->index(j, 0, accountIndex);
and somehow it's thinking some models have got mixed up
This is just a bit weird anyway, so do this
QModelIndex contactIndex = accountIndex->child(j,0);
Dunno if that'll fix it, but it's a bit easier to read.