Commit 61b3ae41 authored by Lukas Appelhans's avatar Lukas Appelhans
Browse files

Fix two hard to spot bugs:

1) don't delete items from the duplicate list which are not duplicates
2) delete old operations, otherwise they'll get signals from our transferhandler
god class and report the same stuff as the normal operation
parent 2d96730e
......@@ -46,6 +46,7 @@ void PerformOperation::start(QHash<APM::OptionName, QStringList> options, QStrin
SyncOperation *syncOp = new SyncOperation(install, m_options, installPkgs, this);
connect(syncOp, SIGNAL(syncFinished()), this, SLOT(secondStep()));
connect(syncOp, SIGNAL(syncFinished()), syncOp, SLOT(deleteLater()));
syncOp->start();
} else {
secondStep();
......@@ -60,6 +61,7 @@ void PerformOperation::secondStep()
RemoveOperation *removeOp = new RemoveOperation(remove, m_options, removePkgs, this);
connect(removeOp, SIGNAL(removeFinished()), this, SIGNAL(performFinished()));
connect(removeOp, SIGNAL(removeFinished()), removeOp, SLOT(deleteLater()));
removeOp->start();
} else {
emit performFinished();
......
......@@ -182,17 +182,18 @@ void SyncOperation::install(QUuid uuid, QList< Akabei::Package* > packages)
QList< Akabei::Package* >::iterator it1;
QList< Akabei::Package* >::iterator it2;
for (it1 = packages.begin(); it1 < packages.end(); it1++) {
for (it1 = packages.begin(); it1 != packages.end(); it1++) {
if ((*it1)->database() == Akabei::Backend::instance()->localDatabase())
continue;
mostRecent = (*it1);
for (it2 = it1 + 1; it2 < packages.end(); it2++) {
if ((*it1)->name() == (*it2)->name() && (*it2)->version() > (*it1)->version()) {
mostRecent = (*it2);
for (it2 = it1 + 1; it2 != packages.end(); it2++) {
if ((*it1)->name() == (*it2)->name()) {
if ((*it2)->version() > (*it1)->version()) {
mostRecent = (*it2);
}
packages.erase(it2);
}
packages.erase(it2);
}
nonDuplicatedPackages << mostRecent;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment