forked from qt-creator/qt-creator
QDeclarativeDebug: Fix when client with ongoing queries is deleted
Will also be fixed in QtDeclarative / 4.8. Reviewed-by: Christiaan Janssen
This commit is contained in:
@@ -82,6 +82,7 @@ public:
|
|||||||
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *);
|
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *);
|
||||||
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *);
|
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *);
|
||||||
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *);
|
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *);
|
||||||
|
static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugWatch *);
|
||||||
|
|
||||||
QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery;
|
QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery;
|
||||||
QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery;
|
QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery;
|
||||||
@@ -122,6 +123,41 @@ QDeclarativeEngineDebugPrivate::~QDeclarativeEngineDebugPrivate()
|
|||||||
{
|
{
|
||||||
if (client)
|
if (client)
|
||||||
client->priv = 0;
|
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()
|
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
|
// from qdeclarativeenginedebug_p.h
|
||||||
struct QDeclarativeObjectData {
|
struct QDeclarativeObjectData {
|
||||||
QUrl url;
|
QUrl url;
|
||||||
@@ -689,6 +733,8 @@ QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent)
|
|||||||
|
|
||||||
QDeclarativeDebugWatch::~QDeclarativeDebugWatch()
|
QDeclarativeDebugWatch::~QDeclarativeDebugWatch()
|
||||||
{
|
{
|
||||||
|
if (m_client && m_queryId != -1)
|
||||||
|
QDeclarativeEngineDebugPrivate::remove(m_client, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int QDeclarativeDebugWatch::queryId() const
|
int QDeclarativeDebugWatch::queryId() const
|
||||||
|
Reference in New Issue
Block a user