commit f3435e4e3468d6b9f4459696582d07f9ed543c4d
parent 71cb71283452081a8d0fe8b13709188aa6632fb7
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 23 Aug 2016 17:58:28 -0700
receipt: retain versions in memory long enough
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/receipt.cpp b/src/receipt.cpp
@@ -17,6 +17,8 @@
#include "receipt.hpp"
+#include "index.hpp"
+
using namespace std;
Receipt::Receipt()
@@ -43,6 +45,9 @@ void Receipt::addTicket(const InstallTicket &ticket)
m_installs.push_back(ticket);
break;
}
+
+ m_indexes.insert(ticket.version->package()->category()
+ ->index()->shared_from_this());
}
void Receipt::addRemovals(const set<Path> &pathList)
diff --git a/src/receipt.hpp b/src/receipt.hpp
@@ -20,12 +20,16 @@
#include <set>
#include <string>
+#include <unordered_set>
#include <vector>
#include "registry.hpp"
+class Index;
class Path;
+typedef std::shared_ptr<const Index> IndexPtr;
+
struct InstallTicket {
enum Type { Install, Upgrade };
@@ -68,6 +72,8 @@ private:
std::vector<InstallTicket> m_updates;
std::set<Path> m_removals;
std::vector<Error> m_errors;
+
+ std::unordered_set<IndexPtr> m_indexes; // keep them alive!
};
#endif