[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/kopete/contactlist
From: Pali Rohár <pali.rohar () gmail ! com>
Date: 2012-10-25 12:19:27
Message-ID: 20121025121927.7ABDDAC855 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1322413 by pali:
Fix crashing Kopete when moving or deleting contact
BUG: 229996
M +6 -3 contactlisttreemodel.cpp
M +3 -1 contactlisttreemodel_p.h
--- trunk/KDE/kdenetwork/kopete/kopete/contactlist/contactlisttreemodel.cpp \
#1322412:1322413 @@ -230,7 +230,7 @@
foreach ( ContactListModelItem* clmi, items )
{
MetaContactModelItem* mcmi = dynamic_cast<MetaContactModelItem*>(clmi);
- if ( mcmi && ( mcmi->metaContact()->isOnline() || \
mcmi->metaContact()->isAlwaysVisible() ) ) + if ( mcmi && mcmi->metaContact() && ( \
mcmi->metaContact()->isOnline() || mcmi->metaContact()->isAlwaysVisible() ) ) \
onlineCount++; }
@@ -329,7 +329,7 @@
}
}
- if ( mcmi )
+ if ( mcmi && mcmi->metaContact() )
{
if ( role == Kopete::Items::MetaContactGroupRole )
return qVariantFromValue( (QObject*)mcmi->parent()->group() );
@@ -356,7 +356,7 @@
// metacontact if all the accounts its contacts belong are online
ContactListModelItem *clmi = itemFor( index );
MetaContactModelItem *mcmi = dynamic_cast<MetaContactModelItem*>(clmi);
- if (mcmi)
+ if (mcmi && mcmi->metaContact())
{
f |= Qt::ItemIsEditable;
bool online = true;
@@ -694,6 +694,7 @@
if ( !clmi->isGroup() )
{
MetaContactModelItem* mcmi = dynamic_cast<MetaContactModelItem*>( clmi );
+ if ( mcmi->metaContact() ) {
QDomElement metaContactElement = doc.createElement( "MetaContact" );
metaContactElement.setAttribute( "uuid", mcmi->metaContact()->metaContactId() \
); metaContactElement.setAttribute( "possition", index++ );
@@ -703,6 +704,7 @@
}
}
}
+}
// Temporary hash, only used for sorting when contact list is loaded.
QHash<const ContactListModelItem*, int>* _contactListModelItemPosition = 0;
@@ -781,6 +783,7 @@
if ( !clmi->isGroup() )
{
MetaContactModelItem* mcmi = dynamic_cast<MetaContactModelItem*>(clmi);
+ if ( mcmi->metaContact() )
uuidToMetaContact.insert( mcmi->metaContact()->metaContactId(), mcmi );
}
}
--- trunk/KDE/kdenetwork/kopete/kopete/contactlist/contactlisttreemodel_p.h \
#1322412:1322413 @@ -18,6 +18,8 @@
#ifndef KOPETE_UI_CONTACTLISTTREEMODEL_P_H
#define KOPETE_UI_CONTACTLISTTREEMODEL_P_H
+#include <QPointer>
+
namespace Kopete {
class Group;
@@ -87,7 +89,7 @@
}
private:
- Kopete::MetaContact* mMetaContact;
+ QPointer <Kopete::MetaContact> mMetaContact;
};
class GroupModelItem : public ContactListModelItem
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic