[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:06:13 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=409fce0
The following commit has been merged in the master branch:
commit 409fce0433c47be24a98c4162b84a82693d0d003
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Tue Jan 15 13:34:21 2013 +0000
Only connect to source model rowInsertion signals once we have processed all existing rows in the model
This fixes a bug in which duplicate contacts could appear
---
KTp/Models/abstract-grouping-proxy-model.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/KTp/Models/abstract-grouping-proxy-model.cpp b/KTp/Models/abstract-grouping-proxy-model.cpp
index f3c3356..2c545ef 100644
--- a/KTp/Models/abstract-grouping-proxy-model.cpp
+++ b/KTp/Models/abstract-grouping-proxy-model.cpp
@@ -125,11 +125,9 @@ KTp::AbstractGroupingProxyModel::AbstractGroupingProxyModel(QAbstractItemModel *
{
d->source = source;
+ //we have to process all existing rows in the model, but must never call a virtual method from a constructor as it will crash.
+ //we use a single shot timer to get round this
QTimer::singleShot(0, this, SLOT(onLoad()));
- connect(d->source, SIGNAL(modelReset()), SLOT(onModelReset()));
- connect(d->source, SIGNAL(rowsInserted(QModelIndex, int,int)), SLOT(onRowsInserted(QModelIndex,int,int)));
- connect(d->source, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SLOT(onRowsRemoved(QModelIndex,int,int)));
- connect(d->source, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(onDataChanged(QModelIndex,QModelIndex)));
}
KTp::AbstractGroupingProxyModel::~AbstractGroupingProxyModel()
@@ -302,6 +300,10 @@ void KTp::AbstractGroupingProxyModel::onLoad()
if (d->source->rowCount() > 0) {
onRowsInserted(QModelIndex(), 0, d->source->rowCount()-1);
}
+ connect(d->source, SIGNAL(modelReset()), SLOT(onModelReset()));
+ connect(d->source, SIGNAL(rowsInserted(QModelIndex, int,int)), SLOT(onRowsInserted(QModelIndex,int,int)));
+ connect(d->source, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SLOT(onRowsRemoved(QModelIndex,int,int)));
+ connect(d->source, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(onDataChanged(QModelIndex,QModelIndex)));
}
/* Called when source model gets reset
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list