don't pay the penalty of checking through the collection when we removed it ourselves; use the iterator we already have when erasing on container deletion instead of making the hash do another lookup based on key
svn path=/trunk/KDE/kdelibs/; revision=1136422
This commit is contained in:
parent
ec543102a2
commit
81ac415af6
@ -320,6 +320,7 @@ void DataEngine::removeSource(const QString &source)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->disconnect(this);
|
||||||
s->deleteLater();
|
s->deleteLater();
|
||||||
d->sources.erase(it);
|
d->sources.erase(it);
|
||||||
emit sourceRemoved(source);
|
emit sourceRemoved(source);
|
||||||
@ -673,10 +674,10 @@ void DataEnginePrivate::sourceDestroyed(QObject *object)
|
|||||||
{
|
{
|
||||||
DataContainer *container = qobject_cast<DataContainer *>(object);
|
DataContainer *container = qobject_cast<DataContainer *>(object);
|
||||||
|
|
||||||
DataEngine::SourceDict::const_iterator it = sources.constBegin();
|
DataEngine::SourceDict::iterator it = sources.begin();
|
||||||
while (it != sources.constEnd()) {
|
while (it != sources.end()) {
|
||||||
if (it.value() == object) {
|
if (it.value() == object) {
|
||||||
sources.remove(it.key());
|
sources.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
Loading…
Reference in New Issue
Block a user