From f13d9cc736aa3d62018fa596231255f5617fff51 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 9 Aug 2023 10:14:04 +0200 Subject: [PATCH 01/15] ProcessStub: Wait for detach to finish Without calling waitpid() after detaching from the inferior a race condition could occur where the ptrace(...) call would finish before it was actually detached, leading to the following gdb to fail attaching as the stub was still attached to it. Calling waitpid here solves the race condition. Fixes: QTCREATORBUG-29463 Change-Id: Ia1d79a18a96078bbf72589bebbc7d7ac027dea0d Reviewed-by: hjk Reviewed-by: --- src/tools/process_stub/main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tools/process_stub/main.cpp b/src/tools/process_stub/main.cpp index 00312b833f6..dfd9ce5613d 100644 --- a/src/tools/process_stub/main.cpp +++ b/src/tools/process_stub/main.cpp @@ -24,6 +24,7 @@ #ifdef Q_OS_LINUX #include +#include #endif #include @@ -221,7 +222,23 @@ void onInferiorStarted() if (!debugMode) sendPid(inferiorId); #else + qCInfo(log) << "Detaching ..."; ptrace(PTRACE_DETACH, inferiorId, 0, SIGSTOP); + + // Wait until the process actually finished detaching + int status = 0; + waitpid(inferiorId, &status, WUNTRACED); + if (log().isInfoEnabled()) { + if (WIFEXITED(status)) + qCInfo(log) << "inferior exited, status=" << WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + qCInfo(log) << "inferior killed by signal" << WTERMSIG(status); + else if (WIFSTOPPED(status)) + qCInfo(log) << "inferior stopped by signal" << WSTOPSIG(status); + else if (WIFCONTINUED(status)) + qCInfo(log) << "inferior continued"; + } + sendPid(inferiorId); #endif } From 9fc53ef7459fbe9e1ff044beb9596ff2f3dd3489 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 10 Aug 2023 10:06:20 +0200 Subject: [PATCH 02/15] RemoteLinux: Do not reject sftp deployment when no info is available We would set up a non-working deploy configuration for devices that existed before 11.0. Amends 3cd0dad3d46ab41bcc7e94d02a4840973779553b. Change-Id: If9d79207c9781e158635e35e211c0071109101db Reviewed-by: hjk --- src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 94bfbfb981f..652a03cdf09 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -29,8 +29,11 @@ FileTransferMethod defaultTransferMethod(Kit *kit) return FileTransferMethod::Rsync; } - if (runDevice && runDevice->extraData(Constants::SupportsSftp).toBool()) - return FileTransferMethod::Sftp; + if (runDevice) { + const QVariant sftpInfo = runDevice->extraData(Constants::SupportsSftp); + if (!sftpInfo.isValid() || sftpInfo.toBool()) + return FileTransferMethod::Sftp; + } return FileTransferMethod::GenericCopy; } From d2434d90dcae2cc91e8fd22577ce7422635494c5 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 10 Aug 2023 09:18:18 +0200 Subject: [PATCH 03/15] ProjectExplorer: prefer git ssh over windows ssh In contrast to the git provided ssh the current ssh provided in windows ignores the SSH_ASKPASS environment variable. So we should prefer the implementation of git. This was done correctly in previous versions of Qt Creator since Environment::searchInPath first went through the additional provided directories before looking into the PATH environment variable. This behavior changed in 11.0 and now we look first into the entries of PATH. Change-Id: I4f3c21866d2d1a5151998fd527978ed482946ef8 Reviewed-by: Marcus Tillmanns Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/devicesupport/sshsettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/sshsettings.cpp b/src/plugins/projectexplorer/devicesupport/sshsettings.cpp index b5f247609e7..be863437f80 100644 --- a/src/plugins/projectexplorer/devicesupport/sshsettings.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshsettings.cpp @@ -107,10 +107,10 @@ static FilePath filePathValue(const FilePath &value, const QStringList &candidat { if (!value.isEmpty()) return value; - const FilePaths additionalSearchPaths = sshSettings->searchPathRetriever(); + Environment env = Environment::systemEnvironment(); + env.prependToPath(sshSettings->searchPathRetriever()); for (const QString &candidate : candidateFileNames) { - const FilePath filePath = Environment::systemEnvironment() - .searchInPath(candidate, additionalSearchPaths); + const FilePath filePath = env.searchInPath(candidate); if (!filePath.isEmpty()) return filePath; } From 66a6cceaf40cbadc6f3f86960ccd8fe9d68ac15b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 10 Aug 2023 15:23:17 +0200 Subject: [PATCH 04/15] CppEditor: Fix possible null pointer access Fixes: QTCREATORBUG-29484 Change-Id: I047ea13e6808902a3b0fb94b9eacdd48e411a22a Reviewed-by: David Schulz --- src/plugins/cppeditor/cpprefactoringchanges.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/cppeditor/cpprefactoringchanges.cpp b/src/plugins/cppeditor/cpprefactoringchanges.cpp index bb34174d06a..f27c0ce83c4 100644 --- a/src/plugins/cppeditor/cpprefactoringchanges.cpp +++ b/src/plugins/cppeditor/cpprefactoringchanges.cpp @@ -124,6 +124,9 @@ bool CppRefactoringFile::isCursorOn(unsigned tokenIndex) const bool CppRefactoringFile::isCursorOn(const AST *ast) const { + if (!ast) + return false; + QTextCursor tc = cursor(); int cursorBegin = tc.selectionStart(); From 49da6d897e539545c04f05eed0d20bd270ac3e05 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 9 Aug 2023 10:31:56 +0200 Subject: [PATCH 05/15] Add 11.0.2 changelog Change-Id: I1bc62db637b68067ca2a087fcba82d9dce2c6636 Reviewed-by: David Schulz --- dist/changelog/changes-11.0.2.md | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 dist/changelog/changes-11.0.2.md diff --git a/dist/changelog/changes-11.0.2.md b/dist/changelog/changes-11.0.2.md new file mode 100644 index 00000000000..91994e79b9f --- /dev/null +++ b/dist/changelog/changes-11.0.2.md @@ -0,0 +1,73 @@ +Qt Creator 11.0.2 +================= + +Qt Creator version 11.0.2 contains bug fixes. + +The most important changes are listed in this document. For a complete list of +changes, see the Git log for the Qt Creator sources that you can check out from +the public Git repository. For example: + + git clone git://code.qt.io/qt-creator/qt-creator.git + git log --cherry-pick --pretty=oneline origin/v11.0.1..v11.0.2 + +General +------- + +* Allow fractional high DPI scaling without modifying the environment + ([QTCREATORBUG-29461](https://bugreports.qt.io/browse/QTCREATORBUG-29461)) + +Editing +------- + +### General + +* Fixed a potential crash when reloading a document + ([QTCREATORBUG-29432](https://bugreports.qt.io/browse/QTCREATORBUG-29432)) + +### Copilot + +* Fixed a crash when configuring an unusable copilot agent in the settings + +Debug +----- + +* Fixed a problem where debugging with "Run In Terminal" would fail on Linux + ([QTCREATORBUG-29463](https://bugreports.qt.io/browse/QTCREATORBUG-29463)) + +Projects +-------- + +### CMake + +* Fixed code completion for ui file components for CMake based projects + ([QTCREATORBUG-28787](https://bugreports.qt.io/browse/QTCREATORBUG-28787)) +* Fix reading ninjaPath from QtCreator.ini + ([QTBUG-115754](https://bugreports.qt.io/browse/QTBUG-115754)) +* Fixed incorrect device checks when using Boot2Qt + ([QTCREATORBUG-29474](https://bugreports.qt.io/browse/QTCREATORBUG-29474)) + +### QMake + +* Avoid cleaning the build directory after switching kits + ([QTCREATORBUG-29451](https://bugreports.qt.io/browse/QTCREATORBUG-29451)) + ([QTCREATORBUG-29481](https://bugreports.qt.io/browse/QTCREATORBUG-29481)) + +Version Control Systems +----------------------- + +### Fossil + +* Show the correct dialog when reverting the current file + +Credits for these changes go to: +-------------------------------- +Aaron Barany +André Pönitz +Björn Schäpers +Christian Kandeler +Cristian Adam +David Schulz +Jaroslaw Kobus +Leena Miettinen +Marcus Tillmanns +Orgad Shaneh From 28754ba08a63eca4b836c7b11892444aeeff5c88 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 11 Aug 2023 14:13:07 +0200 Subject: [PATCH 06/15] LanguageClient: fix showing obsolete proposals When receiving a null proposal and the processor is not running after updating a proposal we need to make sure the previous visible proposal widget gets closed. Change-Id: Icb0a7293698e603df3ba8cab34a08c10fe6784da Reviewed-by: Christian Kandeler --- .../languageclientcompletionassist.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp index c5c86122fcd..62daa1457c4 100644 --- a/src/plugins/languageclient/languageclientcompletionassist.cpp +++ b/src/plugins/languageclient/languageclientcompletionassist.cpp @@ -287,8 +287,13 @@ public: void setProposal(IAssistProposal *proposal, const QString &prefix) { - if (!proposal) + if (!proposal) { + // Close the proposal if we have no running processor otherwise ignore the empty + // proposal and wait for the processor to finish + if (!m_processor || !m_processor->running()) + closeProposal(); return; + } if (proposal->id() != TextEditor::Constants::GENERIC_PROPOSAL_ID) { // We received something else than a generic proposal so we cannot update the model closeProposal(); @@ -305,13 +310,14 @@ public: GenericProposalWidget::updateProposal(std::move(interface)); return; } - auto processor = m_provider->createProcessor(interface.get()); - QTC_ASSERT(processor, return); + m_processor = m_provider->createProcessor(interface.get()); + QTC_ASSERT(m_processor, return); const QString prefix = interface->textAt(m_basePosition, interface->position() - m_basePosition); - processor->setAsyncCompletionAvailableHandler([this, processor, prefix](IAssistProposal *proposal) { + m_processor->setAsyncCompletionAvailableHandler([this, processor = m_processor, prefix]( + IAssistProposal *proposal) { QTC_ASSERT(processor == m_processor, return); if (!processor->running()) { // do not delete this processor directly since this function is called from within the processor @@ -324,11 +330,11 @@ public: setProposal(proposal, prefix); }); - setProposal(processor->start(std::move(interface)), prefix); - if (processor->running()) - m_processor = processor; - else - delete processor; + setProposal(m_processor->start(std::move(interface)), prefix); + if (!m_processor->running()) { + delete m_processor; + m_processor = nullptr; + } } private: From 7bb49b58df0431e8c4a65319a58e713c58957647 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 11 Aug 2023 14:41:14 +0200 Subject: [PATCH 07/15] Core: fix IDocuments aboutToSave and saved filePath The function emiting those signals can be called with an empty file path. Use the document file path in this case like in TextDocument::saveImpl. Change-Id: I9e3381999a25c49df1d5db060ef5467b12220ad4 Reviewed-by: Christian Kandeler --- src/plugins/coreplugin/idocument.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp index 5dcff9d3fc1..7be7e410116 100644 --- a/src/plugins/coreplugin/idocument.cpp +++ b/src/plugins/coreplugin/idocument.cpp @@ -343,10 +343,10 @@ IDocument::OpenResult IDocument::open(QString *errorString, const Utils::FilePat */ bool IDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave) { - emit aboutToSave(filePath, autoSave); + emit aboutToSave(filePath.isEmpty() ? this->filePath() : filePath, autoSave); const bool success = saveImpl(errorString, filePath, autoSave); if (success) - emit saved(filePath, autoSave); + emit saved(filePath.isEmpty() ? this->filePath() : filePath, autoSave); return success; } From 6f9a97fd137e470fc2ac2c9a7772bc64170efa2d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 14 Aug 2023 16:24:37 +0200 Subject: [PATCH 08/15] CMakeProjectManager: Deselect "Stage for installation" for iOS Simulator There is no CMake install target for iOS Simulator. Therefore, the "Stage for installation" option needs to be deseleceted, like it is being done for iOS device. Amends: 2387e9e37aeb5b4acf6b2b1bdb1f8f047e23c1d4 Fixes: QTCREATORBUG-29293 Fixes: QTCREATORBUG-29475 Change-Id: I6406446534c1ddedbf01cdab4d074bddc44dc495 Reviewed-by: hjk --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 94f2bf912d6..33e2b682325 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -188,6 +188,7 @@ static bool supportsStageForInstallation(const Kit *kit) return runDevice->id() != buildDevice->id() && runDevice->type() != Android::Constants::ANDROID_DEVICE_TYPE && runDevice->type() != Ios::Constants::IOS_DEVICE_TYPE + && runDevice->type() != Ios::Constants::IOS_SIMULATOR_TYPE && runDevice->type() != WebAssembly::Constants::WEBASSEMBLY_DEVICE_TYPE; } From 4605bf57dd50a221c2228c90656fd43a0ec68c56 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 14 Aug 2023 16:39:02 +0200 Subject: [PATCH 09/15] CMakeProjectManager: Deselect "Stage for installation" for BareMetal There is no CMake install target for BareMetal. Therefore, the "Stage for installation" option needs to be deseleceted, like it is being done for other devices. Amends: 2387e9e37aeb5b4acf6b2b1bdb1f8f047e23c1d4 Fixes: QTCREATORBUG-29293 Change-Id: Ic0e61ab19318f6383f55e6330b7559a734706a0e Reviewed-by: hjk --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 33e2b682325..f52db4b6912 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -14,6 +14,8 @@ #include +#include + #include #include @@ -189,6 +191,7 @@ static bool supportsStageForInstallation(const Kit *kit) && runDevice->type() != Android::Constants::ANDROID_DEVICE_TYPE && runDevice->type() != Ios::Constants::IOS_DEVICE_TYPE && runDevice->type() != Ios::Constants::IOS_SIMULATOR_TYPE + && runDevice->type() != BareMetal::Constants::BareMetalOsType && runDevice->type() != WebAssembly::Constants::WEBASSEMBLY_DEVICE_TYPE; } From 324e92417859949b67a7ed4e32c4e2ed6ece734b Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 10 Aug 2023 06:44:12 +0200 Subject: [PATCH 10/15] Utils: Fix FilePath::isRootPath() Change-Id: I287bae74469ba501ecb03d51f04f7aaa5f4a7268 Reviewed-by: hjk --- src/libs/utils/filepath.cpp | 32 ++++++++++++++++---- tests/auto/utils/filepath/tst_filepath.cpp | 35 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 049ae325bd8..3995ddde3a7 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -204,7 +204,27 @@ FilePath FilePath::currentWorkingPath() bool FilePath::isRootPath() const { - // FIXME: Make host-independent + if (needsDevice()) { + QStringView path = pathView(); + if (osType() != OsTypeWindows) + return path == QLatin1String("/"); + + // Remote windows paths look like this: "/c:/", so we remove the leading '/' + if (path.startsWith('/')) + path = path.mid(1); + + if (path.length() > 3) + return false; + + if (!startsWithDriveLetter()) + return false; + + if (path.length() == 3 && path[2] != QLatin1Char('/')) + return false; + + return true; + } + return *this == FilePath::fromString(QDir::rootPath()); } @@ -1346,15 +1366,15 @@ bool FilePath::contains(const QString &s) const /*! \brief Checks whether the FilePath starts with a drive letter. - - Defaults to \c false if it is a non-Windows host or represents a path on device - Returns whether FilePath starts with a drive letter */ bool FilePath::startsWithDriveLetter() const { - const QStringView p = pathView(); - return !needsDevice() && p.size() >= 2 && isWindowsDriveLetter(p[0]) && p.at(1) == ':'; + QStringView p = pathView(); + if (needsDevice() && !p.isEmpty()) + p = p.mid(1); + + return p.size() >= 2 && isWindowsDriveLetter(p[0]) && p.at(1) == ':'; } /*! diff --git a/tests/auto/utils/filepath/tst_filepath.cpp b/tests/auto/utils/filepath/tst_filepath.cpp index f9e10d5e207..6a269af7712 100644 --- a/tests/auto/utils/filepath/tst_filepath.cpp +++ b/tests/auto/utils/filepath/tst_filepath.cpp @@ -115,6 +115,8 @@ private slots: void sort(); void sort_data(); + void isRootPath(); + private: QTemporaryDir tempDir; QString rootPath; @@ -1308,6 +1310,14 @@ void tst_filepath::startsWithDriveLetter_data() QTest::newRow("simple-win") << FilePath::fromString("c:/a") << true; QTest::newRow("simple-linux") << FilePath::fromString("/c:/a") << false; QTest::newRow("relative") << FilePath("a/b") << false; + + QTest::newRow("remote-slash") << FilePath::fromString("docker://1234/") << false; + QTest::newRow("remote-single-letter") << FilePath::fromString("docker://1234/c") << false; + QTest::newRow("remote-drive") << FilePath::fromString("docker://1234/c:") << true; + QTest::newRow("remote-invalid-drive") << FilePath::fromString("docker://1234/c:a") << true; + QTest::newRow("remote-with-path") << FilePath::fromString("docker://1234/c:/a") << true; + QTest::newRow("remote-z") << FilePath::fromString("docker://1234/z:") << true; + QTest::newRow("remote-1") << FilePath::fromString("docker://1234/1:") << false; } void tst_filepath::startsWithDriveLetter() @@ -1656,6 +1666,31 @@ void tst_filepath::sort() QCOMPARE(sortedPaths, sorted); } +void tst_filepath::isRootPath() +{ + FilePath localRoot = FilePath::fromString(QDir::rootPath()); + QVERIFY(localRoot.isRootPath()); + + FilePath localNonRoot = FilePath::fromString(QDir::rootPath() + "x"); + QVERIFY(!localNonRoot.isRootPath()); + + if (HostOsInfo::isWindowsHost()) { + FilePath remoteWindowsRoot = FilePath::fromString("device://test/c:/"); + QVERIFY(remoteWindowsRoot.isRootPath()); + + FilePath remoteWindowsRoot1 = FilePath::fromString("device://test/c:"); + QVERIFY(remoteWindowsRoot1.isRootPath()); + + FilePath remoteWindowsNotRoot = FilePath::fromString("device://test/c:/x"); + QVERIFY(!remoteWindowsNotRoot.isRootPath()); + } else { + FilePath remoteRoot = FilePath::fromString("device://test/"); + QVERIFY(remoteRoot.isRootPath()); + + FilePath remotePath = FilePath::fromString("device://test/x"); + QVERIFY(!remotePath.isRootPath()); + } +} void tst_filepath::sort_data() { QTest::addColumn("input"); From 02e2a642dc21831af13893c74c81d4ad59e0e25e Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 15 Aug 2023 15:27:15 +0200 Subject: [PATCH 11/15] ProcessStub: Add missing if When not starting in debug mode, the inferior is not waiting for ptrace(DETACH), so the code that calls DETACH waits for something that does not happen. Fixes: QTCREATORBUG-29503 Change-Id: Ic00a52b9e4f3a797d1be337a2ce53afc6ee63927 Reviewed-by: Cristian Adam --- src/tools/process_stub/main.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/tools/process_stub/main.cpp b/src/tools/process_stub/main.cpp index dfd9ce5613d..702450f8b7f 100644 --- a/src/tools/process_stub/main.cpp +++ b/src/tools/process_stub/main.cpp @@ -222,21 +222,23 @@ void onInferiorStarted() if (!debugMode) sendPid(inferiorId); #else - qCInfo(log) << "Detaching ..."; - ptrace(PTRACE_DETACH, inferiorId, 0, SIGSTOP); + if (debugMode) { + qCInfo(log) << "Detaching ..."; + ptrace(PTRACE_DETACH, inferiorId, 0, SIGSTOP); - // Wait until the process actually finished detaching - int status = 0; - waitpid(inferiorId, &status, WUNTRACED); - if (log().isInfoEnabled()) { - if (WIFEXITED(status)) - qCInfo(log) << "inferior exited, status=" << WEXITSTATUS(status); - else if (WIFSIGNALED(status)) - qCInfo(log) << "inferior killed by signal" << WTERMSIG(status); - else if (WIFSTOPPED(status)) - qCInfo(log) << "inferior stopped by signal" << WSTOPSIG(status); - else if (WIFCONTINUED(status)) - qCInfo(log) << "inferior continued"; + // Wait until the process actually finished detaching + int status = 0; + waitpid(inferiorId, &status, WUNTRACED); + if (log().isInfoEnabled()) { + if (WIFEXITED(status)) + qCInfo(log) << "inferior exited, status=" << WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + qCInfo(log) << "inferior killed by signal" << WTERMSIG(status); + else if (WIFSTOPPED(status)) + qCInfo(log) << "inferior stopped by signal" << WSTOPSIG(status); + else if (WIFCONTINUED(status)) + qCInfo(log) << "inferior continued"; + } } sendPid(inferiorId); From 397cd1ba3ddf489903793a33c62f4d6a665ca87c Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 16 Aug 2023 12:48:46 +0200 Subject: [PATCH 12/15] AutoTest: Fix using target information after kit change Fixes: QTCREATORBUG-29477 Change-Id: I5d1f8d65ed074d912740b87eac1c7d4413ed2588 Reviewed-by: David Schulz --- src/plugins/autotest/ctest/ctesttreeitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/autotest/ctest/ctesttreeitem.cpp b/src/plugins/autotest/ctest/ctesttreeitem.cpp index 9ffc06b028e..ed5401cc13c 100644 --- a/src/plugins/autotest/ctest/ctesttreeitem.cpp +++ b/src/plugins/autotest/ctest/ctesttreeitem.cpp @@ -83,7 +83,7 @@ QList CTestTreeItem::testConfigurationsFor(const QStringLi if (!project) return {}; - const ProjectExplorer::Target *target = project->targets().value(0); + const ProjectExplorer::Target *target = ProjectExplorer::ProjectManager::startupTarget(); if (!target) return {}; From 8761b7c20c13858b1c2bb759f32f4e1be282aa60 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 17 Aug 2023 13:34:38 +0200 Subject: [PATCH 13/15] LanguageClient: Fix settings loading Amends de247bff2b15a9eb1eaece9077abecd4369176ba Change-Id: Iab31da31058247a20451eeb2427152caab02c594 Reviewed-by: hjk --- src/plugins/languageclient/languageclientsettings.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/languageclient/languageclientsettings.cpp b/src/plugins/languageclient/languageclientsettings.cpp index 650b450a5d3..349a84f7b88 100644 --- a/src/plugins/languageclient/languageclientsettings.cpp +++ b/src/plugins/languageclient/languageclientsettings.cpp @@ -120,16 +120,15 @@ public: applyCurrentSettings(); LanguageClientManager::applySettings(); - for (BaseSettings *setting : m_model.removed()) { + for (BaseSettings *setting : m_settings.removed()) { for (Client *client : LanguageClientManager::clientsForSetting(setting)) LanguageClientManager::shutdownClient(client); } int row = currentRow(); - m_model.reset(LanguageClientManager::currentSettings()); + m_settings.reset(LanguageClientManager::currentSettings()); resetCurrentSettings(row); } - void finish() { m_settings.reset(LanguageClientManager::currentSettings()); @@ -148,7 +147,6 @@ private: LanguageClientSettingsModel &m_settings; QSet &m_changedSettings; - LanguageClientSettingsModel m_model; }; QMap &clientTypes() @@ -302,8 +300,6 @@ LanguageClientSettingsPage::LanguageClientSettingsPage() void LanguageClientSettingsPage::init() { m_model.reset(LanguageClientSettings::fromSettings(Core::ICore::settings())); - apply(); - finish(); } QList LanguageClientSettingsPage::settings() const @@ -603,6 +599,7 @@ static LanguageClientSettingsPage &settingsPage() void LanguageClientSettings::init() { settingsPage().init(); + LanguageClientManager::applySettings(); } QList LanguageClientSettings::fromSettings(QSettings *settingsIn) From e9b3cd548cd3e9f872344f518c01387dc6af814b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 11 Aug 2023 17:48:47 +0200 Subject: [PATCH 14/15] CPlusPlus: Fix crash on weird-looking construct This was misparsed as a function with an initializer (e.g. "= default"), and then the empty id caused trouble later on. Fixes: QTCREATORBUG-29386 Change-Id: I85a35db544e11ad85f50e3a15b1a071b36e79cd0 Reviewed-by: Qt CI Bot Reviewed-by: David Schulz Reviewed-by: --- src/libs/3rdparty/cplusplus/Parser.cpp | 5 +++++ tests/auto/cplusplus/ast/tst_ast.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp index 6bf19f59829..395556777dd 100644 --- a/src/libs/3rdparty/cplusplus/Parser.cpp +++ b/src/libs/3rdparty/cplusplus/Parser.cpp @@ -3020,6 +3020,11 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp if (!_languageFeatures.cxx11Enabled || LA(2) == T_NUMERIC_LITERAL) { parseInitializer(node->initializer, &node->equal_token); } else { + if (LA(2) != T_NUMERIC_LITERAL && LA(2) != T_DEFAULT && LA(2) != T_DELETE) { + error(cursor(), "expected 'default', 'delete' or '0', got '%s'", tok(2).spell()); + return false; + } + node->equal_token = consumeToken(); IdExpressionAST *id_expr = new (_pool) IdExpressionAST; diff --git a/tests/auto/cplusplus/ast/tst_ast.cpp b/tests/auto/cplusplus/ast/tst_ast.cpp index fc1ab3538e8..5790cb090ac 100644 --- a/tests/auto/cplusplus/ast/tst_ast.cpp +++ b/tests/auto/cplusplus/ast/tst_ast.cpp @@ -190,6 +190,7 @@ private slots: void enumDeclaration(); void invalidEnumClassDeclaration(); void invalidEnumWithDestructorId(); + void invalidFunctionInitializer(); }; void tst_AST::gcc_attributes_1() @@ -2052,6 +2053,14 @@ void tst_AST::invalidEnumWithDestructorId() QVERIFY(diag.errorCount != 0); } +void tst_AST::invalidFunctionInitializer() +{ + QSharedPointer unit(parse( + "int main() { a t=b; c d(e)=\"\"; }", TranslationUnit::ParseTranlationUnit, false, false, true)); + + QVERIFY(diag.errorCount != 0); +} + void tst_AST::initTestCase() { control.setDiagnosticClient(&diag); From 64b852e18648a9f7501a1c121da404a6cea0858b Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Fri, 18 Aug 2023 16:12:06 +0200 Subject: [PATCH 15/15] Terminal: Fix default environment vars Fixes: QTCREATORBUG-29515 Change-Id: I1d14f228f946a64a8d3cdb17f57ae9058db549ff Reviewed-by: Cristian Adam --- src/libs/3rdparty/libptyqt/unixptyprocess.cpp | 20 +------------------ src/plugins/terminal/terminalwidget.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/libs/3rdparty/libptyqt/unixptyprocess.cpp b/src/libs/3rdparty/libptyqt/unixptyprocess.cpp index 4c67ee28fb0..a72712c1eb4 100644 --- a/src/libs/3rdparty/libptyqt/unixptyprocess.cpp +++ b/src/libs/3rdparty/libptyqt/unixptyprocess.cpp @@ -184,34 +184,16 @@ bool UnixPtyProcess::startProcess(const QString &shellPath, m_readMasterNotify->disconnect(); }); - QStringList defaultVars; - - defaultVars.append("TERM=xterm-256color"); - defaultVars.append("ITERM_PROFILE=Default"); - defaultVars.append("XPC_FLAGS=0x0"); - defaultVars.append("XPC_SERVICE_NAME=0"); - defaultVars.append("LANG=en_US.UTF-8"); - defaultVars.append("LC_ALL=en_US.UTF-8"); - defaultVars.append("LC_CTYPE=UTF-8"); - defaultVars.append("INIT_CWD=" + QCoreApplication::applicationDirPath()); - defaultVars.append("COMMAND_MODE=unix2003"); - defaultVars.append("COLORTERM=truecolor"); - QStringList varNames; foreach (QString line, environment) { varNames.append(line.split("=").first()); } - //append default env vars only if they don't exists in current env - foreach (QString defVar, defaultVars) { - if (!varNames.contains(defVar.split("=").first())) - environment.append(defVar); - } - QProcessEnvironment envFormat; foreach (QString line, environment) { envFormat.insert(line.split("=").first(), line.split("=").last()); } + m_shellProcess.setWorkingDirectory(workingDir); m_shellProcess.setProcessEnvironment(envFormat); m_shellProcess.setReadChannel(QProcess::StandardOutput); diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index dd105223536..a2c566c8f0a 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -149,6 +149,13 @@ void TerminalWidget::setupPty() Environment env = m_openParameters.environment.value_or(Environment{}) .appliedToEnvironment(shellCommand.executable().deviceEnvironment()); + // Set some useful defaults + env.setFallback("TERM", "xterm-256color"); + env.setFallback("TERM_PROGRAM", QCoreApplication::applicationName()); + env.setFallback("COLORTERM", "truecolor"); + env.setFallback("COMMAND_MODE", "unix2003"); + env.setFallback("INIT_CWD", QCoreApplication::applicationDirPath()); + // For git bash on Windows env.prependOrSetPath(shellCommand.executable().parentDir()); if (env.hasKey("CLINK_NOAUTORUN"))