From 81ac415af667cca7a085f9573af5b2ceabe38e12 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 9 Jun 2010 19:09:13 +0000 Subject: [PATCH] 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 --- dataengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dataengine.cpp b/dataengine.cpp index 91434e288..1c40dd991 100644 --- a/dataengine.cpp +++ b/dataengine.cpp @@ -320,6 +320,7 @@ void DataEngine::removeSource(const QString &source) } } + s->disconnect(this); s->deleteLater(); d->sources.erase(it); emit sourceRemoved(source); @@ -673,10 +674,10 @@ void DataEnginePrivate::sourceDestroyed(QObject *object) { DataContainer *container = qobject_cast(object); - DataEngine::SourceDict::const_iterator it = sources.constBegin(); - while (it != sources.constEnd()) { + DataEngine::SourceDict::iterator it = sources.begin(); + while (it != sources.end()) { if (it.value() == object) { - sources.remove(it.key()); + sources.erase(it); break; } ++it;