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

svn at pcbsd.org svn at pcbsd.org
Wed Aug 10 09:33:10 PDT 2011


Author: kris
Date: 2011-08-10 09:33:10 -0700 (Wed, 10 Aug 2011)
New Revision: 12070

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

Fixed a bug where AppCafe would crash when removing the last item from the PBI list



Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2011-08-10 16:17:49 UTC (rev 12069)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp	2011-08-10 16:33:10 UTC (rev 12070)
@@ -36,9 +36,9 @@
   QTreeWidgetItemIterator it(*currentCheckingPBI);
   PBI *item = dynamic_cast<PBI*>(*it);
   if (*it) {
-    if ( item->getWorkingStatus() != PBIINACTIVE || item->getProgIndexName().isEmpty())
+    if ( item->getWorkingStatus() != PBIINACTIVE || item->getProgIndexName().isEmpty() || item->doDelete() )
     {
-       // This PBI is missing a update URL or is already busy, skip to next!
+       // This PBI is missing a update URL, is already busy or deleted, skip to next!
        (*currentCheckingPBI)++;
        QTimer::singleShot(100, this, SLOT(slotPBICheckUpdate() ) );
        return;
@@ -154,9 +154,11 @@
    QTreeWidgetItemIterator it(SoftwareListBox);
    while (*it) {
      PBI *item = dynamic_cast<PBI*>(*it);
-     if (item->doDelete() ) {
+     if (item->doDelete() && item->getName() != "PBIDELETED" ) {
        qDebug() << "Deleting: " << item->getName();
-       delete item;
+       SoftwareListBox->removeItemWidget(item, 0);
+       item->setName("PBIDELETED");
+       //delete item;
      }
      ++it;
    }
@@ -200,7 +202,6 @@
   } else {
     // Purge any deleted items before starting a new Iterator
     purgeAllDeletedPBI();
-
     currentWorkingPBI = new QTreeWidgetItemIterator(SoftwareListBox);
   }
   
@@ -326,7 +327,7 @@
   } else {
 
      // If this is a new install, also add the desktop icon
-     if ( item->getWorkingStatus() == PBINEWDOWNLOAD )
+     if ( item->getWorkingStatus() == PBINEWDOWNLOAD && ! item->doDelete())
 	installDesktopIcon(item);
 
      // Update the status on the previous download to finished



More information about the Commits mailing list