diff -r ef0373b55136 -r 758a864f9613 src/declarative/util/qdeclarativelistmodelworkeragent.cpp --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp Fri Sep 17 08:34:18 2010 +0300 +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp Mon Oct 04 01:19:32 2010 +0300 @@ -187,12 +187,17 @@ s->data = data; s->list = m_copy; data.changes.clear(); + + mutex.lock(); QCoreApplication::postEvent(this, s); + syncDone.wait(&mutex); + mutex.unlock(); } bool QDeclarativeListModelWorkerAgent::event(QEvent *e) { if (e->type() == QEvent::User) { + QMutexLocker locker(&mutex); Sync *s = static_cast(e); const QList &changes = s->data.changes; @@ -202,13 +207,18 @@ FlatListModel *orig = m_orig->m_flat; FlatListModel *copy = s->list->m_flat; - if (!orig || !copy) + if (!orig || !copy) { + syncDone.wakeAll(); return QObject::event(e); - + } + orig->m_roles = copy->m_roles; orig->m_strings = copy->m_strings; orig->m_values = copy->m_values; + syncDone.wakeAll(); + locker.unlock(); + for (int ii = 0; ii < changes.count(); ++ii) { const Change &change = changes.at(ii); switch (change.type) { @@ -229,6 +239,8 @@ if (cc) emit m_orig->countChanged(); + } else { + syncDone.wakeAll(); } }