From 0f139b27a1c324b2fc0386da8a598258b0d85f95 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Wed, 4 Nov 2009 14:12:56 +0100 Subject: [PATCH] Projectexplorer: Fix hang when launching external explorer for folder. Task-number: QTCREATORBUG-221 Use QProcess::startDetached. Reviewed-by: con <qtc-committer@nokia.com> --- src/plugins/projectexplorer/projectexplorer.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index acc2280d8dc..c6ced1fbb4c 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1864,16 +1864,14 @@ void ProjectExplorerPlugin::showInGraphicalShell() { QTC_ASSERT(d->m_currentNode, return) #if defined(Q_OS_WIN) - QString explorer = Environment::systemEnvironment().searchInPath("explorer.exe"); + const QString explorer = Environment::systemEnvironment().searchInPath("explorer.exe"); if (explorer.isEmpty()) { QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Launching Windows Explorer failed"), tr("Could not find explorer.exe in path to launch Windows Explorer.")); return; } - QProcess::execute(explorer, - QStringList() << QString("/select,%1") - .arg(QDir::toNativeSeparators(d->m_currentNode->path()))); + QProcess::startDetached(explorer, QStringList(QLatin1String("/select,") + QDir::toNativeSeparators(d->m_currentNode->path()))); #elif defined(Q_OS_MAC) QProcess::execute("/usr/bin/osascript", QStringList() << "-e" @@ -1884,15 +1882,15 @@ void ProjectExplorerPlugin::showInGraphicalShell() << "tell application \"Finder\" to activate"); #else // we cannot select a file here, because no file browser really supports it... - QFileInfo fileInfo(d->m_currentNode->path()); - QString xdgopen = Environment::systemEnvironment().searchInPath("xdg-open"); + const QFileInfo fileInfo(d->m_currentNode->path()); + const QString xdgopen = Environment::systemEnvironment().searchInPath("xdg-open"); if (xdgopen.isEmpty()) { QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Launching a file explorer failed"), tr("Could not find xdg-open to launch the native file explorer.")); return; } - QProcess::execute(xdgopen, QStringList() << fileInfo.path()); + QProcess::startDetached(xdgopen, QStringList(fileInfo.path())); #endif } -- GitLab