Commit fa5d3ab3 authored by Kai Koehne's avatar Kai Koehne
Browse files

QDeclarativeDebug: Fix when client with ongoing queries is deleted

Will also be fixed in QtDeclarative / 4.8.

Reviewed-by: Christiaan Janssen
parent 227b06b2
......@@ -82,6 +82,7 @@ public:
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *);
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *);
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *);
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugWatch *);
QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery;
QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery;
......@@ -122,6 +123,41 @@ QDeclarativeEngineDebugPrivate::~QDeclarativeEngineDebugPrivate()
{
if (client)
client->priv = 0;
delete client;
QHash<int, QDeclarativeDebugEnginesQuery*>::iterator enginesIter = enginesQuery.begin();
for (; enginesIter != enginesQuery.end(); ++enginesIter) {
enginesIter.value()->m_client = 0;
if (enginesIter.value()->state() == QDeclarativeDebugQuery::Waiting)
enginesIter.value()->setState(QDeclarativeDebugQuery::Error);
}
QHash<int, QDeclarativeDebugRootContextQuery*>::iterator rootContextIter = rootContextQuery.begin();
for (; rootContextIter != rootContextQuery.end(); ++rootContextIter) {
rootContextIter.value()->m_client = 0;
if (rootContextIter.value()->state() == QDeclarativeDebugQuery::Waiting)
rootContextIter.value()->setState(QDeclarativeDebugQuery::Error);
}
QHash<int, QDeclarativeDebugObjectQuery*>::iterator objectIter = objectQuery.begin();
for (; objectIter != objectQuery.end(); ++objectIter) {
objectIter.value()->m_client = 0;
if (objectIter.value()->state() == QDeclarativeDebugQuery::Waiting)
objectIter.value()->setState(QDeclarativeDebugQuery::Error);
}
QHash<int, QDeclarativeDebugExpressionQuery*>::iterator exprIter = expressionQuery.begin();
for (; exprIter != expressionQuery.end(); ++exprIter) {
exprIter.value()->m_client = 0;
if (exprIter.value()->state() == QDeclarativeDebugQuery::Waiting)
exprIter.value()->setState(QDeclarativeDebugQuery::Error);
}
QHash<int, QDeclarativeDebugWatch*>::iterator watchIter = watched.begin();
for (; watchIter != watched.end(); ++watchIter) {
watchIter.value()->m_client = 0;
watchIter.value()->setState(QDeclarativeDebugWatch::Dead);
}
}
int QDeclarativeEngineDebugPrivate::getId()
......@@ -146,6 +182,14 @@ void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c,
}
}
void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugWatch *w)
{
if (c && w) {
QDeclarativeEngineDebugPrivate *p = c->d_func();
p->watched.remove(w->m_queryId);
}
}
// from qdeclarativeenginedebug_p.h
struct QDeclarativeObjectData {
QUrl url;
......@@ -689,6 +733,8 @@ QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent)
QDeclarativeDebugWatch::~QDeclarativeDebugWatch()
{
if (m_client && m_queryId != -1)
QDeclarativeEngineDebugPrivate::remove(m_client, this);
}
int QDeclarativeDebugWatch::queryId() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment