grab the source name before removing the iterator

the previous fix, which i accidentally reverted while cleaning up this code,
was actually wrong (so in a way i'm glad i caught it): the signal MUST be emitted
AFTER the item is removed from the collection otherwise any code that checks to
see if that source exists will see that it does still exist even though it was
just signaled as being removed. order sometimes really matters :)

CCMAIL:kde@rusu.info
BUG:287795
This commit is contained in:
Aaron Seigo 2011-11-30 09:17:01 +01:00
parent 523ef55a7b
commit 7074f1b74f

View File

@ -302,10 +302,11 @@ void DataEngine::removeAllSources()
while (it.hasNext()) {
it.next();
Plasma::DataContainer *s = it.value();
const QString &source = it.key();
it.remove();
s->disconnect(this);
s->deleteLater();
emit sourceRemoved(it.key());
it.remove();
emit sourceRemoved(source);
}
}