1. Wake up the syncDone wait condition when delete the QDeclarativeListModelWorkerAgent,
otherwise the the whole worker script engine thread will hang at the sync() call
and can't exit gracefully.
2. Call QCoreApplication::processEvents() before delete the worker script engine to
cleanup all pending events in main thread to release wait conditions which
some worker scripts/agents are waiting for (QDeclarativeListModelWorkerAgent::sync() for example)
Change-Id: Ia3712318771633e68238b4d629ba870ff7ce45b9
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
{
}
+QDeclarativeListModelWorkerAgent::~QDeclarativeListModelWorkerAgent()
+{
+ mutex.lock();
+ syncDone.wakeAll();
+ mutex.unlock();
+}
+
void QDeclarativeListModelWorkerAgent::setV8Engine(QV8Engine *eng)
{
m_copy->m_engine = eng;
public:
QDeclarativeListModelWorkerAgent(QDeclarativeListModel *);
-
+ ~QDeclarativeListModelWorkerAgent();
void setV8Engine(QV8Engine *eng);
void addref();
QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QDeclarativeWorkerScriptEnginePrivate::WorkerDestroyEvent));
d->m_lock.unlock();
+ //We have to force to cleanup the main thread's event queue here
+ //to make sure the main GUI release all pending locks/wait conditions which
+ //some worker script/agent are waiting for (QDeclarativeListModelWorkerAgent::sync() for example).
+ QCoreApplication::processEvents();
wait();
d->deleteLater();
}