OSDN Git Service

Projectexplorer: Fix hang when launching external explorer for folder.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Wed, 4 Nov 2009 13:12:56 +0000 (14:12 +0100)
committercon <qtc-committer@nokia.com>
Wed, 4 Nov 2009 17:53:01 +0000 (18:53 +0100)
Task-number: QTCREATORBUG-221

Use QProcess::startDetached.
Reviewed-by: con <qtc-committer@nokia.com>
(cherry picked from commit 0f139b27a1c324b2fc0386da8a598258b0d85f95)

src/plugins/projectexplorer/projectexplorer.cpp

index acc2280..c6ced1f 100644 (file)
@@ -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
 }