From 4ec63a715212ee09bbde3ac706f012f3c0ab6b55 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 11 Jul 2013 12:04:34 +0200 Subject: [PATCH 1/4] QML debugger: Fix remote debugging with port forwarding involved. Full explanation inside. Change-Id: Ib39f18282b7d78ebdab53ac2ebe9d4cf1e11c008 Reviewed-by: Aurindam Jana --- src/plugins/debugger/qml/qmlengine.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index d0390d61c5d..0e07172d0fe 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -413,18 +413,24 @@ void QmlEngine::beginConnection(quint16 port) if (host.isEmpty()) host = QLatin1String("localhost"); - if (port > 0) { - QTC_ASSERT(startParameters().connParams.port == 0 - || startParameters().connParams.port == port, - qWarning() << "Port " << port << "from application output does not match" - << startParameters().connParams.port << "from start parameters."); - m_adapter.beginConnectionTcp(host, port); - return; - } - // no port from application output, use the one from start parameters ... - m_adapter.beginConnectionTcp(host, startParameters().qmlServerPort); + /* + * Let plugin-specific code override the port printed by the application. This is necessary + * in the case of port forwarding, when the port the application listens on is not the same that + * we want to connect to. + * NOTE: It is still necessary to wait for the output in that case, because otherwise we cannot + * be sure that the port is already open. The usual method of trying to connect repeatedly + * will not work, because the intermediate port is already open. So the connection + * will be accepted on that port but the forwarding to the target port will fail and + * the connection will be closed again (instead of returning the "connection refused" + * error that we expect). + */ + if (startParameters().qmlServerPort > 0) + port = startParameters().qmlServerPort; + + m_adapter.beginConnectionTcp(host, port); } + void QmlEngine::connectionStartupFailed() { if (m_retryOnConnectFail) { From 173da5f45b9c5604cbd8adcad5bc57739e127c86 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 16 Jul 2013 22:31:27 +0300 Subject: [PATCH 2/4] Git: Set diff base directory for log Log can also contain diff, base directory is required for correct apply/revert actions Change-Id: I9540fc75b1e008a1c8433f121b184f164172a1cb Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index fe3a6ee882c..59c38d60c68 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1114,6 +1114,7 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName enableAnnotationContextMenu, args, fileNames)); editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + editor->setDiffBaseDirectory(workingDirectory); QStringList arguments; arguments << QLatin1String("log") << QLatin1String(noColorOption) From 885520d9541d21744c9fccfcdeb5dec2e34f1843 Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Thu, 18 Jul 2013 16:02:28 +0200 Subject: [PATCH 3/4] RemoteLinuxAnalyzeSupport: Fix empty remote command line to device Currently only QML profiling is supported. Pass the remote command along with -qmljsdebugger argument to device. Change-Id: Ia64396f9c6da80e70cb1ee624ed974f8cc32465f Reviewed-by: Christian Kandeler --- .../remotelinux/remotelinuxanalyzesupport.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 1e4adc1ba55..3563053bce5 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -121,25 +121,26 @@ void RemoteLinuxAnalyzeSupport::startExecution() { QTC_ASSERT(state() == GatheringPorts, return); - if (d->qmlProfiling && !setPort(d->qmlPort)) - return; + // Currently we support only QML profiling + QTC_ASSERT(d->qmlProfiling, return); + + if (!setPort(d->qmlPort)) + return; setState(StartingRunner); DeviceApplicationRunner *runner = appRunner(); connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteErrorOutput(QByteArray))); connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); - if (d->qmlProfiling) - connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); - QString args = arguments(); - if (d->qmlProfiling) - args += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort); - const QString remoteCommandLine = d->qmlProfiling - ? QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args) - : QString(); + connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool))); connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString))); + + const QString args = arguments() + + QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort); + const QString remoteCommandLine = + QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args); runner->start(device(), remoteCommandLine.toUtf8()); } From 56bdad140cf914d5e016972f773e3d31992af2a2 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 19 Jul 2013 12:43:57 +0200 Subject: [PATCH 4/4] Fix crash with splitting and non-splittable editors We may not just add an editor to a view without removing it from the original view. Task-number: QTCREATORBUG-9843 Change-Id: I1041ceb1f063bb627b5f0bd16bc3b2973a4dc3b6 Reviewed-by: Eike Ziller --- .../coreplugin/editormanager/editormanager.cpp | 13 ++++++++++--- .../coreplugin/editormanager/editormanager.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index c3d04a6a2ce..e898895f39a 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1225,12 +1225,15 @@ void EditorManager::closeDuplicate(Core::IEditor *editor) } } -Core::IEditor *EditorManager::pickUnusedEditor() const +Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView) const { foreach (IEditor *editor, openedEditors()) { EditorView *view = viewForEditor(editor); - if (!view || view->currentEditor() != editor) + if (!view || view->currentEditor() != editor) { + if (foundView) + *foundView = view; return editor; + } } return 0; } @@ -1282,8 +1285,12 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core view->addEditor(editor); view->setCurrentEditor(editor); if (!sourceView->currentEditor()) { - if (IEditor *replacement = pickUnusedEditor()) + EditorView *replacementView = 0; + if (IEditor *replacement = pickUnusedEditor(&replacementView)) { + if (replacementView) + replacementView->removeEditor(replacement); sourceView->addEditor(replacement); + } } return editor; } else if (duplicateSupported) { diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 556dfc65aa8..f76fc151936 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -277,7 +277,7 @@ private: void closeView(Internal::EditorView *view); void emptyView(Internal::EditorView *view); static void splitNewWindow(Internal::EditorView *view); - IEditor *pickUnusedEditor() const; + IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0) const; void addDocumentToRecentFiles(IDocument *document); void updateAutoSave(); void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable);