]> git.saurik.com Git - apt.git/commitdiff
Call "Dequeue()" for items in AbortTransaction() to fix race
authorMichael Vogt <mvo@ubuntu.com>
Tue, 4 Nov 2014 13:47:59 +0000 (14:47 +0100)
committerMichael Vogt <mvo@ubuntu.com>
Tue, 4 Nov 2014 13:47:59 +0000 (14:47 +0100)
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.

apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h

index ba1669de0dc889dcaafe86cfeed717ad13f6f496..f684e81f182f0661620fc238e938160879ad80a2 100644 (file)
@@ -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();
 }
index 4b4ef5fca8f56c0b5646ff3b07864248ce1d4cdb..d6eca3e5071c5a50956cc6e30a87cfa6cb5f736a 100644 (file)
@@ -63,6 +63,8 @@ class pkgAcqMetaBase;
  */
 class pkgAcquire::Item : public WeakPointable
 {  
+   friend pkgAcqMetaBase;
+
    void *d;
 
    protected: