Skip to content

Commit

Permalink
Attempt to workaround #137
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Jun 22, 2018
1 parent 4bb7597 commit c4567dc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ffsengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class FfsEngine : public QObject
UINT8 replace(const QModelIndex & index, const QByteArray & object, const UINT8 mode);
UINT8 remove(const QModelIndex & index);
UINT8 rebuild(const QModelIndex & index);
UINT8 doNotRebuild(const QModelIndex & index);
UINT8 doNotRebuild(const QModelIndex & index);
UINT8 dump(const QModelIndex & index, const QString & path, const QString & filter = QString());
UINT8 patch(const QModelIndex & index, const QVector<PatchData> & patches);

Expand Down
19 changes: 17 additions & 2 deletions treeitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,22 @@ void TreeItem::setAction(const UINT8 action)

// Set rebuild action for parent, if it has no action now
if (parentItem && parentItem->type() != Types::Root
&& parentItem->action() == Actions::NoAction)
&& parentItem->action() == Actions::NoAction) {
parentItem->setAction(Actions::Rebuild);
}

// Set rebuild action for subsequent items after parent.
// This is a little ugly, but fixes UEFIReplace image corruption,
// where one cannot manually choose the targets for rebuild.
// See: https://github.com/LongSoft/UEFITool/issues/137
TreeItem *grandParent = parentItem->parentItem;
if (grandParent) {
QList<TreeItem *> &parentCousins = grandParent->childItems;
int count = parentCousins.count();
for (int i = parentCousins.indexOf(parentItem) + 1; i < count; i++) {
TreeItem *parentCousin = parentCousins.value(i, NULL);
if (parentCousin && parentCousin->action() == Actions::NoAction)
parentCousin->setAction(Actions::Rebuild);
}
}
}
}

0 comments on commit c4567dc

Please sign in to comment.