OSDN Git Service

Make MaemoInstallPackagToSysroot* thread-safe
authorDaniel Teske <daniel.teske@nokia.com>
Thu, 13 Oct 2011 16:51:15 +0000 (18:51 +0200)
committerDaniel Teske <daniel.teske@nokia.com>
Fri, 14 Oct 2011 12:43:31 +0000 (14:43 +0200)
Change-Id: If4ded3f5596c16409012edf267d96a72c3b7f4ad
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
src/plugins/madde/maemoinstalltosysrootstep.cpp
src/plugins/madde/maemoinstalltosysrootstep.h

index 7ee2462..49eee32 100644 (file)
@@ -41,7 +41,6 @@
 #include <qt4projectmanager/qt4buildconfiguration.h>
 #include <qt4projectmanager/qt4target.h>
 #include <qtsupport/baseqtversion.h>
-#include <remotelinux/deployablefile.h>
 #include <remotelinux/deploymentinfo.h>
 #include <remotelinux/remotelinuxdeployconfiguration.h>
 
@@ -321,6 +320,13 @@ bool MaemoCopyToSysrootStep::init()
         return false;
     }
     m_systemRoot = qtVersion->systemRoot();
+
+    const QSharedPointer<DeploymentInfo> deploymentInfo
+            = static_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
+    m_files.clear();
+    for (int i = 0; i < deploymentInfo->deployableCount(); ++i)
+        m_files << deploymentInfo->deployableAt(i);
+
     return true;
 }
 
@@ -328,11 +334,9 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
 {
     emit addOutput(tr("Copying files to sysroot ..."), MessageOutput);
     QDir sysrootDir(m_systemRoot);
-    const QSharedPointer<DeploymentInfo> deploymentInfo
-        = qobject_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
+
     const QChar sep = QLatin1Char('/');
-    for (int i = 0; i < deploymentInfo->deployableCount(); ++i) {
-        const DeployableFile &deployable = deploymentInfo->deployableAt(i);
+    foreach (const DeployableFile &deployable, m_files) {
         const QFileInfo localFileInfo(deployable.localFilePath);
         const QString targetFilePath = m_systemRoot + sep
             + deployable.remoteDir + sep + localFileInfo.fileName();
index 8c81866..3f1d270 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <projectexplorer/abstractprocessstep.h>
 #include <projectexplorer/buildstep.h>
+#include <remotelinux/deployablefile.h>
 
 #include <QtCore/QStringList>
 
@@ -122,6 +123,7 @@ public:
     static QString displayName();
 private:
     QString m_systemRoot;
+    QList<RemoteLinux::DeployableFile> m_files;
 };
 
 class MaemoMakeInstallToSysrootStep : public ProjectExplorer::AbstractProcessStep