Commit 58e697bc authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlDebug: Fix crash on app closing

Make sure that the engineClient object is the parent of all of its
queries, since the destructor of a query might try to access the client
...

Reviewed-by: Christiaan Janssen
Task-number: QTCREATORBUG-4105
parent bd2e4af9
......@@ -306,7 +306,7 @@ bool ClientProxy::resetBindingForObject(int objectDebugId, const QString& proper
return result;
}
QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent)
QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectDebugId, const QString &expr)
{
if (objectDebugId == -1)
return 0;
......@@ -317,7 +317,8 @@ QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectD
bool block = m_adapter->disableJsDebugging(true);
log(LogSend, QString("EVAL_EXPRESSION %1 %2").arg(QString::number(objectDebugId), expr));
QDeclarativeDebugExpressionQuery *query = m_engineClient->queryExpressionResult(objectDebugId,expr,parent);
QDeclarativeDebugExpressionQuery *query
= m_engineClient->queryExpressionResult(objectDebugId, expr, m_engineClient);
m_adapter->disableJsDebugging(block);
return query;
......@@ -348,7 +349,7 @@ bool ClientProxy::addObjectWatch(int objectDebugId)
// is flooding the debugging output log!
// log(LogSend, QString("WATCH_PROPERTY %1").arg(objectDebugId));
QDeclarativeDebugWatch *watch = m_engineClient->addWatch(ref, this);
QDeclarativeDebugWatch *watch = m_engineClient->addWatch(ref, m_engineClient);
m_objectWatches.insert(objectDebugId, watch);
connect(watch,SIGNAL(valueChanged(QByteArray,QVariant)),this,SLOT(objectWatchTriggered(QByteArray,QVariant)));
......@@ -412,7 +413,8 @@ void ClientProxy::queryEngineContext(int id)
log(LogSend, QString("LIST_OBJECTS %1").arg(QString::number(id)));
m_contextQuery = m_engineClient->queryRootContexts(QDeclarativeDebugEngineReference(id), this);
m_contextQuery = m_engineClient->queryRootContexts(QDeclarativeDebugEngineReference(id),
m_engineClient);
if (!m_contextQuery->isWaiting())
contextChanged();
else
......@@ -446,7 +448,8 @@ void ClientProxy::fetchContextObjectRecursive(const QDeclarativeDebugContextRefe
log(LogSend, QString("FETCH_OBJECT %1").arg(obj.idString()));
QDeclarativeDebugObjectQuery* query = m_engineClient->queryObjectRecursive(obj, this);
QDeclarativeDebugObjectQuery* query
= m_engineClient->queryObjectRecursive(obj, m_engineClient);
if (!query->isWaiting()) {
query->deleteLater(); //ignore errors;
} else {
......@@ -632,7 +635,7 @@ void ClientProxy::reloadEngines()
log(LogSend, QString("LIST_ENGINES"));
m_engineQuery = m_engineClient->queryAvailableEngines(this);
m_engineQuery = m_engineClient->queryAvailableEngines(m_engineClient);
if (!m_engineQuery->isWaiting()) {
updateEngineList();
} else {
......
......@@ -67,7 +67,7 @@ public:
bool setMethodBodyForObject(int objectDebugId, const QString &methodName, const QString &methodBody);
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent=0);
QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId, const QString &expr);
void clearComponentCache();
bool addObjectWatch(int objectDebugId);
......
......@@ -271,7 +271,7 @@ void InspectorUi::showDebuggerTooltip(const QPoint &mousePos, TextEditor::ITextE
}
if (!query.isEmpty()) {
m_debugQuery = m_clientProxy->queryExpressionResult(ref.debugId(),query, this);
m_debugQuery = m_clientProxy->queryExpressionResult(ref.debugId(), query);
connect(m_debugQuery, SIGNAL(stateChanged(QDeclarativeDebugQuery::State)),
this, SLOT(debugQueryUpdated(QDeclarativeDebugQuery::State)));
}
......@@ -630,7 +630,7 @@ void InspectorUi::selectItems(const QList<int> &objectIds)
void InspectorUi::changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression)
{
QString query = propertyName + '=' + valueExpression;
m_clientProxy->queryExpressionResult(debugId, query, this);
m_clientProxy->queryExpressionResult(debugId, query);
}
void InspectorUi::enable()
......
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