From 555b87cf917f741689413646500a8dd8ee80342c Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Thu, 19 Dec 2013 18:27:30 -0500
Subject: [PATCH] [ #36524 ] Try to improve contact list stability

---
 src/contactproxymodel.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/contactproxymodel.cpp b/src/contactproxymodel.cpp
index f78b0c4d..a7fab376 100644
--- a/src/contactproxymodel.cpp
+++ b/src/contactproxymodel.cpp
@@ -184,9 +184,11 @@ void ContactProxyModel::reloadCategories()
    emit layoutAboutToBeChanged();
    beginResetModel();
    m_hCategories.clear();
+   beginRemoveRows(QModelIndex(),0,m_lCategoryCounter.size()-1);
    foreach(TopLevelItem* item,m_lCategoryCounter) {
       delete item;
    }
+   endRemoveRows();
    m_lCategoryCounter.clear();
    foreach(Contact* cont, m_pModel->getContactList()) {
       if (cont) {
@@ -414,7 +416,7 @@ QModelIndex ContactProxyModel::parent( const QModelIndex& index) const
 
 QModelIndex ContactProxyModel::index( int row, int column, const QModelIndex& parent) const
 {
-   if (parent.isValid()) {
+   if (parent.isValid() && parent.internalPointer()) {
       CategorizedCompositeNode* parentNode = static_cast<CategorizedCompositeNode*>(parent.internalPointer());
       switch(parentNode->type()) {
          case CategorizedCompositeNode::Type::TOP_LEVEL: {
-- 
GitLab