commit aef02fc8833ce9ec84f6a5531e90ae28a04f68bb
parent 16e9cb56b1d7f0f3f159c4c22082808096284eaf
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 4 May 2016 22:13:31 -0400
support toggling pinned status of obsolete packages without crashing
Diffstat:
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -887,7 +887,11 @@ bool Browser::apply()
}
if(entry->pin) {
- tx->setPinned(entry->package, *entry->pin);
+ if(entry->regEntry)
+ tx->setPinned(entry->regEntry, *entry->pin);
+ else
+ tx->setPinned(entry->package, *entry->pin);
+
entry->pin = boost::none;
}
}
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -233,6 +233,14 @@ void Transaction::setPinned(const Package *pkg, const bool pinned)
addTask(task);
}
+void Transaction::setPinned(const Registry::Entry &entry, const bool pinned)
+{
+ DummyTask *task = new DummyTask(this);
+ task->onCommit(bind(&Registry::setPinned, m_registry, entry, pinned));
+
+ addTask(task);
+}
+
void Transaction::uninstall(const Remote &remote)
{
inhibit(remote);
@@ -302,6 +310,10 @@ void Transaction::finish()
registerQueued();
}
+ assert(m_downloadQueue.idle());
+ assert(m_taskQueue.empty());
+ assert(m_regQueue.empty());
+
m_onFinish();
m_cleanupHandler();
}
diff --git a/src/transaction.hpp b/src/transaction.hpp
@@ -52,6 +52,7 @@ public:
void synchronize(const Remote &, const InstallOpts &);
void install(const Version *);
void setPinned(const Package *, bool pinned);
+ void setPinned(const Registry::Entry &, bool pinned);
void uninstall(const Remote &);
void uninstall(const Registry::Entry &);
void registerAll(const Remote &);