forked from qt-creator/qt-creator
QmlJSInspector: Check for null pointers
Change-Id: I8d99b109909e596ead2e674eff0de576b2dca411 Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
@@ -174,6 +174,7 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
|
||||
void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status)
|
||||
{
|
||||
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
|
||||
QTC_ASSERT(client, return);
|
||||
if (status == QmlDebug::Enabled) {
|
||||
m_toolsClient = client;
|
||||
|
||||
@@ -212,8 +213,7 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
|
||||
m_toolsClient->showAppOnTop(true);
|
||||
|
||||
m_toolsClientConnected = true;
|
||||
} else if (m_toolsClientConnected
|
||||
&& client == m_toolsClient) {
|
||||
} else if (m_toolsClientConnected && client == m_toolsClient) {
|
||||
disconnect(client, SIGNAL(currentObjectsChanged(QList<int>)),
|
||||
this, SLOT(selectObjectsFromToolsClient(QList<int>)));
|
||||
disconnect(client, SIGNAL(logActivity(QString,QString)),
|
||||
@@ -246,8 +246,7 @@ void QmlInspectorAdapter::engineClientStatusChanged(QmlDebug::ClientStatus statu
|
||||
if (status == QmlDebug::Enabled) {
|
||||
QTC_ASSERT(client, return);
|
||||
setActiveEngineClient(client);
|
||||
} else if (m_engineClientConnected &&
|
||||
(client == m_engineClient)) {
|
||||
} else if (m_engineClientConnected && client == m_engineClient) {
|
||||
m_engineClientConnected = false;
|
||||
deletePreviews();
|
||||
}
|
||||
@@ -367,6 +366,7 @@ void QmlInspectorAdapter::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc
|
||||
|
||||
void QmlInspectorAdapter::onSelectActionTriggered(bool checked)
|
||||
{
|
||||
QTC_ASSERT(toolsClient(), return);
|
||||
if (checked) {
|
||||
toolsClient()->setDesignModeBehavior(true);
|
||||
toolsClient()->changeToSelectTool();
|
||||
@@ -378,6 +378,7 @@ void QmlInspectorAdapter::onSelectActionTriggered(bool checked)
|
||||
|
||||
void QmlInspectorAdapter::onZoomActionTriggered(bool checked)
|
||||
{
|
||||
QTC_ASSERT(toolsClient(), return);
|
||||
if (checked) {
|
||||
toolsClient()->setDesignModeBehavior(true);
|
||||
toolsClient()->changeToZoomTool();
|
||||
@@ -390,7 +391,7 @@ void QmlInspectorAdapter::onZoomActionTriggered(bool checked)
|
||||
void QmlInspectorAdapter::onShowAppOnTopChanged(const QVariant &value)
|
||||
{
|
||||
bool showAppOnTop = value.toBool();
|
||||
if (m_toolsClient->status() == QmlDebug::Enabled)
|
||||
if (m_toolsClient && m_toolsClient->status() == QmlDebug::Enabled)
|
||||
m_toolsClient->showAppOnTop(showAppOnTop);
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@ void QmlInspectorAdapter::gotoObjectReferenceDefinition(
|
||||
void QmlInspectorAdapter::selectObject(const ObjectReference &obj,
|
||||
SelectionTarget target)
|
||||
{
|
||||
if (target == ToolTarget)
|
||||
if (m_toolsClient && target == ToolTarget)
|
||||
m_toolsClient->setObjectIdList(
|
||||
QList<ObjectReference>() << obj);
|
||||
|
||||
@@ -525,6 +526,7 @@ void QmlInspectorAdapter::onReload()
|
||||
fileContents);
|
||||
}
|
||||
}
|
||||
if (m_toolsClient)
|
||||
m_toolsClient->reload(changesHash);
|
||||
}
|
||||
|
||||
|
@@ -189,6 +189,7 @@ protected:
|
||||
Q_UNUSED(scriptBinding);
|
||||
Q_UNUSED(parentDefinition);
|
||||
appliedChangesToViewer = true;
|
||||
if (m_inspectorAdapter->engineClient())
|
||||
m_inspectorAdapter->engineClient()->setMethodBody(debugId,
|
||||
methodName, methodBody);
|
||||
}
|
||||
@@ -217,6 +218,7 @@ protected:
|
||||
if (isLiteral)
|
||||
expr = castToLiteral(scriptCode, scriptBinding);
|
||||
appliedChangesToViewer = true;
|
||||
if (m_inspectorAdapter->engineClient())
|
||||
m_inspectorAdapter->engineClient()->setBindingForObject(
|
||||
debugId, propertyName, expr,
|
||||
isLiteral, document()->fileName(),
|
||||
@@ -226,12 +228,14 @@ protected:
|
||||
virtual void resetBindingForObject(int debugId, const QString &propertyName)
|
||||
{
|
||||
appliedChangesToViewer = true;
|
||||
if (m_inspectorAdapter->engineClient())
|
||||
m_inspectorAdapter->engineClient()->resetBindingForObject(debugId, propertyName);
|
||||
}
|
||||
|
||||
virtual void removeObject(int debugId)
|
||||
{
|
||||
appliedChangesToViewer = true;
|
||||
if (m_inspectorAdapter->toolsClient())
|
||||
m_inspectorAdapter->toolsClient()->destroyQmlObject(debugId);
|
||||
}
|
||||
|
||||
@@ -242,12 +246,14 @@ protected:
|
||||
{
|
||||
appliedChangesToViewer = true;
|
||||
referenceRefreshRequired = true;
|
||||
if (m_inspectorAdapter->toolsClient())
|
||||
m_inspectorAdapter->toolsClient()->createQmlObject(qmlText, ref, importList, filename, order);
|
||||
}
|
||||
|
||||
virtual void reparentObject(int debugId, int newParent)
|
||||
{
|
||||
appliedChangesToViewer = true;
|
||||
if (m_inspectorAdapter->toolsClient())
|
||||
m_inspectorAdapter->toolsClient()->reparentQmlObject(debugId, newParent);
|
||||
}
|
||||
|
||||
@@ -617,7 +623,7 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
||||
m_previousDoc = doc;
|
||||
if (!delta.newObjects.isEmpty())
|
||||
m_createdObjects[doc] += delta.newObjects;
|
||||
|
||||
if (m_inspectorAdapter->toolsClient())
|
||||
m_inspectorAdapter->toolsClient()->clearComponentCache();
|
||||
}
|
||||
}
|
||||
@@ -697,7 +703,8 @@ void QmlLiveTextPreview::showSyncWarning(
|
||||
if (editor) {
|
||||
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
|
||||
Core::InfoBarEntry info(INFO_OUT_OF_SYNC, errorMessage);
|
||||
if (m_inspectorAdapter->toolsClient()->supportReload())
|
||||
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
|
||||
if (toolsClient && toolsClient->supportReload())
|
||||
info.setCustomButtonInfo(tr("Reload QML"), this,
|
||||
SLOT(reloadQml()));
|
||||
infoBar->addInfo(info);
|
||||
|
Reference in New Issue
Block a user