diff --git a/dist/changes-4.7.2.md b/dist/changes-4.7.2.md index 262463113f3..710e6e4f13b 100644 --- a/dist/changes-4.7.2.md +++ b/dist/changes-4.7.2.md @@ -7,11 +7,21 @@ 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/v4.7.1..v4.7.2 +General + +* Fixed crash when pressing wrong shortcut for recent projects in Welcome mode + (QTCREATORBUG-21302) +* Fixed rare crash in file system view + Editing * Fixed that collapsed text no longer showed up in tooltip (QTCREATORBUG-21040) * Fixed crash with generic text completion (QTCREATORBUG-21192) +Generic Projects + +* Fixed crash when adding file to sub-folder (QTCREATORBUG-21342) + C++ Support * Fixed wrong value of `__cplusplus` define (QTCREATORBUG-20884) @@ -31,6 +41,11 @@ Windows * Fixed saving of files when another application blocks atomic save operation (QTCREATORBUG-7668) +* Fixed wrongly added empty lines in application output (QTCREATORBUG-21215) + +iOS + +* Fixed issue with detecting iPhone XS (QTCREATORBUG-21291) Remote Linux diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 1b6abf740c3..b58b9300b83 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -373,13 +373,25 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent connect(m_listView, &QAbstractItemView::activated, this, [this](const QModelIndex &index) { openItem(m_sortProxyModel->mapToSource(index)); }); - // use QueuedConnection for updating crumble path, because that can scroll, which doesn't - // work well when done directly in currentChanged (the wrong item can get highlighted) + // Delay updating crumble path by event loop cylce, because that can scroll, which doesn't + // work well when done directly in currentChanged (the wrong item can get highlighted). + // We cannot use Qt::QueuedConnection directly, because the QModelIndex could get invalidated + // in the meantime, so use a queued invokeMethod instead. connect(m_listView->selectionModel(), &QItemSelectionModel::currentChanged, this, - &FolderNavigationWidget::setCrumblePath, - Qt::QueuedConnection); + [this](const QModelIndex &index) { + const QModelIndex sourceIndex = m_sortProxyModel->mapToSource(index); + const auto filePath = Utils::FileName::fromString( + m_fileSystemModel->filePath(sourceIndex)); + // QTimer::singleShot only posts directly onto the event loop if you use the SLOT("...") + // notation, so using a singleShot with a lambda would flicker + // QTimer::singleShot(0, this, [this, filePath]() { setCrumblePath(filePath); }); + QMetaObject::invokeMethod(this, + "setCrumblePath", + Qt::QueuedConnection, + Q_ARG(Utils::FileName, filePath)); + }); connect(m_crumbLabel, &Utils::FileCrumbLabel::pathClicked, [this](const Utils::FileName &path) { const QModelIndex rootIndex = m_sortProxyModel->mapToSource(m_listView->rootIndex()); const QModelIndex fileIndex = m_fileSystemModel->index(path.toString()); @@ -623,7 +635,7 @@ void FolderNavigationWidget::selectFile(const Utils::FileName &filePath) } else { m_listView->scrollTo(fileIndex); } - setCrumblePath(fileIndex); + setCrumblePath(filePath); }); } } @@ -699,12 +711,12 @@ void FolderNavigationWidget::createNewFolder(const QModelIndex &parent) m_listView->edit(index); } -void FolderNavigationWidget::setCrumblePath(const QModelIndex &index) +void FolderNavigationWidget::setCrumblePath(const Utils::FileName &filePath) { - const QModelIndex sourceIndex = m_sortProxyModel->mapToSource(index); + const QModelIndex index = m_fileSystemModel->index(filePath.toString()); const int width = m_crumbLabel->width(); const int previousHeight = m_crumbLabel->immediateHeightForWidth(width); - m_crumbLabel->setPath(Utils::FileName::fromString(m_fileSystemModel->filePath(sourceIndex))); + m_crumbLabel->setPath(filePath); const int currentHeight = m_crumbLabel->immediateHeightForWidth(width); const int diff = currentHeight - previousHeight; if (diff != 0 && m_crumbLabel->isVisible()) { diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h index f10f69d595d..5c8a2e24f6a 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.h +++ b/src/plugins/projectexplorer/foldernavigationwidget.h @@ -118,6 +118,9 @@ public: protected: void contextMenuEvent(QContextMenuEvent *ev) override; +private slots: + void setCrumblePath(const Utils::FileName &filePath); + private: bool rootAutoSynchronization() const; void setRootAutoSynchronization(bool sync); @@ -131,7 +134,6 @@ private: QStringList projectsInDirectory(const QModelIndex &index) const; void openProjectsInDirectory(const QModelIndex &index); void createNewFolder(const QModelIndex &parent); - void setCrumblePath(const QModelIndex &index); Core::IContext *m_context = nullptr; Utils::NavigationTreeView *m_listView = nullptr; diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index bfc493ad5af..53a9fd1625a 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -423,6 +423,7 @@ public: void requestDeviceInfo(const QString &deviceId, int timeout); QStringList errors(); void addError(QString errorMsg); + QString deviceId(AMDeviceRef device); void addDevice(AMDeviceRef device); void removeDevice(AMDeviceRef device); void checkPendingLookups(); @@ -654,11 +655,18 @@ void IosDeviceManagerPrivate::addError(QString errorMsg) emit q->errorMsg(errorMsg); } -void IosDeviceManagerPrivate::addDevice(AMDeviceRef device) +QString IosDeviceManagerPrivate::deviceId(AMDeviceRef device) { CFStringRef s = m_lib.deviceCopyDeviceIdentifier(device); - QString devId = QString::fromCFString(s); + // remove dashes as a hotfix for QTCREATORBUG-21291 + const auto id = QString::fromCFString(s).remove('-'); if (s) CFRelease(s); + return id; +} + +void IosDeviceManagerPrivate::addDevice(AMDeviceRef device) +{ + const QString devId = deviceId(device); CFRetain(device); DeviceInterfaceType interfaceType = static_cast(lib()->deviceGetInterfaceType(device)); @@ -703,10 +711,7 @@ void IosDeviceManagerPrivate::addDevice(AMDeviceRef device) void IosDeviceManagerPrivate::removeDevice(AMDeviceRef device) { - CFStringRef s = m_lib.deviceCopyDeviceIdentifier(device); - QString devId = QString::fromCFString(s); - if (s) - CFRelease(s); + const QString devId = deviceId(device); if (debugAll) qDebug() << "removeDevice " << devId; if (m_devices.contains(devId)) {