Blob Blame History Raw
commit ec91add0e6398ad20c7a8f14a1a08c5e3282c5bd
Author: Michail Pishchagin <mblsha@users.sourceforge.net>
Date:   Tue Oct 19 11:26:31 2010 +0400

    Fix crash in MUCAffiliationsModel on Qt 4.7 (closes #1087)
    Based on 1610-psi-fix-crash-in-muc-configurator.diff from Psi+

diff --git a/src/mucaffiliationsmodel.cpp b/src/mucaffiliationsmodel.cpp
index 722b762..fd0a830 100644
--- a/src/mucaffiliationsmodel.cpp
+++ b/src/mucaffiliationsmodel.cpp
@@ -150,15 +150,18 @@ void MUCAffiliationsModel::resetAffiliationLists()
 
 void MUCAffiliationsModel::resetAffiliationList(MUCItem::Affiliation a)
 {
+	emit layoutAboutToBeChanged();
 	enabled_[(AffiliationListIndex) affiliationToIndex(a)] = false;
 	QModelIndex index = affiliationListIndex(a);
 	if (hasChildren(index)) {
 		removeRows(0,rowCount(index),index);
 	}
+	emit layoutChanged();
 }
 
 void MUCAffiliationsModel::setAffiliationListEnabled(MUCItem::Affiliation a, bool b)
 {
+	emit layoutAboutToBeChanged();
 	QModelIndex index = affiliationListIndex(a);
 	enabled_[(AffiliationListIndex) index.row()] = b;
 	emit layoutChanged();
@@ -208,6 +211,9 @@ void MUCAffiliationsModel::addItems(const QList<MUCItem>& items)
 	foreach(MUCItem item, items) {
 		QModelIndex list = affiliationListIndex(item.affiliation());
 		if (list.isValid() && !item.jid().isEmpty()) {
+			if (!dirty) {
+				emit layoutAboutToBeChanged();
+			}
 			int row = rowCount(list);
 			if (row == 0) {
 				enabled_[(AffiliationListIndex) list.row()] = true;