[PC-BSD Commits] r14047 - pcbsd/current/src-qt4/pc-softwaremanager

svn at pcbsd.org svn at pcbsd.org
Mon Nov 28 10:52:49 PST 2011


Author: kris
Date: 2011-11-28 10:52:49 -0800 (Mon, 28 Nov 2011)
New Revision: 14047

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
Log:

Improve appcafe to make sure we wait and kill the fetch / pbi_add properly when canceled or exiting




Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-11-28 18:39:06 UTC (rev 14046)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-11-28 18:52:49 UTC (rev 14047)
@@ -167,9 +167,9 @@
         // Yep, ready to cancel, lets stop the download / update
 	if ( upgradePBIProc->state() == QProcess::Starting || upgradePBIProc->state() == QProcess::Running ) {
           upgradePBIProc->terminate();
-	  upgradePBIProc->waitForFinished(1000);
+	  upgradePBIProc->waitForFinished(5000);
           upgradePBIProc->kill();
-	  upgradePBIProc->waitForFinished(1000);
+	  upgradePBIProc->waitForFinished(5000);
 	}
         isWorkingOnPBI = true;
         return true;
@@ -249,12 +249,21 @@
           return;
         }
 
-  	if ( pbi->isWorking() )
-		upgradePBIProc->kill();		 
+	if ( pbi->isWorking() ) {
+	  qDebug() << "Stopping PBI download...";
+	  pbi->setDownloadFailed(true);
+	  // Yep, ready to cancel, lets stop the download / update
+          if ( upgradePBIProc->state() == QProcess::Starting || upgradePBIProc->state() == QProcess::Running ) {
+            upgradePBIProc->terminate();
+            upgradePBIProc->waitForFinished(5000);
+            upgradePBIProc->kill();
+            upgradePBIProc->waitForFinished(5000);
+          }
+	}
 
         // Remove the PBI
         RemovePBI(pbi);
-  
+
         // Repopulate the list
         PopulateList();
 
@@ -277,7 +286,7 @@
     pbi->setDelete(true);
 
     // Check if this is a real PBI, or just a download item we want to remove
-    if ( ! pbi->isNewDownload() )
+    if ( ! pbi->isNewDownload() && pbi->getDownloadFailed() != true )
     {
       // This is a already installed PBI, lets remove it now
       qDebug() << "Removing PBI: " + pbi->getProgIndexName();



More information about the Commits mailing list