Prechádzať zdrojové kódy

Call "Dequeue()" for items in AbortTransaction() to fix race

The pkgAcquire::Run() code works uses a while(ToFetch > 0) loop
over the items queued for fetching. This means that we need to
Deqeueue the item if we call AbortTransaction() to avoid a hang.
Michael Vogt 11 rokov pred
rodič
commit
53702a590c
2 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  1. 3 0
      apt-pkg/acquire-item.cc
  2. 2 0
      apt-pkg/acquire-item.h

+ 3 - 0
apt-pkg/acquire-item.cc

@@ -1547,7 +1547,10 @@ void pkgAcqMetaBase::AbortTransaction()
          std::clog << "  Cancel: " << (*I)->DestFile << std::endl;
       // the transaction will abort, so stop anything that is idle
       if ((*I)->Status == pkgAcquire::Item::StatIdle)
+      {
          (*I)->Status = pkgAcquire::Item::StatDone;
+         (*I)->Dequeue();
+      }
    }
    Transaction.clear();
 }

+ 2 - 0
apt-pkg/acquire-item.h

@@ -63,6 +63,8 @@ class pkgAcqMetaBase;
  */
 class pkgAcquire::Item : public WeakPointable
 {  
+   friend pkgAcqMetaBase;
+
    void *d;
 
    protected: