Version 0.8.1

- memory management improved
- heap corruption is (hopefully) no more
This commit is contained in:
Nikolaj Schlej 2013-11-17 12:13:37 +01:00
parent 3d7dad6bb6
commit 84ce5deeca
5 changed files with 20 additions and 14 deletions

View File

@ -48,10 +48,10 @@ TreeModel* FfsEngine::model() const
void FfsEngine::msg(const QString & message, const QModelIndex index) void FfsEngine::msg(const QString & message, const QModelIndex index)
{ {
messageItems.enqueue(new MessageListItem(message, NULL, 0, index)); messageItems.enqueue(MessageListItem(message, NULL, 0, index));
} }
QQueue<MessageListItem*> FfsEngine::message() QQueue<MessageListItem> FfsEngine::message()
{ {
return messageItems; return messageItems;
} }
@ -2018,7 +2018,7 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue<QByteArray> & que
return result; return result;
// Check for auth status valid attribute // Check for auth status valid attribute
if (guidDefinedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) { if (guidDefinedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {
msg(tr("reconstruct: %1: GUID defined section signature can become invalid invalid") msg(tr("reconstruct: %1: GUID defined section signature can now become invalid")
.arg(guidToQString(guidDefinedHeader->SectionDefinitionGuid))); .arg(guidToQString(guidDefinedHeader->SectionDefinitionGuid)));
} }
// Replace new section body // Replace new section body

View File

@ -38,7 +38,7 @@ public:
TreeModel* model() const; TreeModel* model() const;
// Returns message items queue // Returns message items queue
QQueue<MessageListItem*> message(); QQueue<MessageListItem> message();
// Firmware image parsing // Firmware image parsing
UINT8 parseInputFile(const QByteArray & buffer); UINT8 parseInputFile(const QByteArray & buffer);
@ -77,7 +77,7 @@ private:
TreeModel *treeModel; TreeModel *treeModel;
// Message helper // Message helper
QQueue<MessageListItem*> messageItems; QQueue<MessageListItem> messageItems;
void msg(const QString & message, const QModelIndex index = QModelIndex()); void msg(const QString & message, const QModelIndex index = QModelIndex());
// Internal operations // Internal operations

View File

@ -64,6 +64,8 @@ void UEFITool::init()
ui->actionSaveImageFile->setDisabled(true); ui->actionSaveImageFile->setDisabled(true);
// Make new ffsEngine // Make new ffsEngine
if (ffsEngine)
delete ffsEngine;
ffsEngine = new FfsEngine(this); ffsEngine = new FfsEngine(this);
ui->structureTreeView->setModel(ffsEngine->model()); ui->structureTreeView->setModel(ffsEngine->model());
@ -200,10 +202,11 @@ void UEFITool::saveImageFile()
QByteArray reconstructed; QByteArray reconstructed;
UINT8 result = ffsEngine->reconstructImage(reconstructed); UINT8 result = ffsEngine->reconstructImage(reconstructed);
showMessage();
if (result) if (result)
{ {
ui->statusBar->showMessage(tr("Reconstruction failed (%1)").arg(result)); ui->statusBar->showMessage(tr("Reconstruction failed (%1)").arg(result));
showMessage();
return; return;
} }
@ -211,7 +214,6 @@ void UEFITool::saveImageFile()
outputFile.write(reconstructed); outputFile.write(reconstructed);
outputFile.close(); outputFile.close();
ui->statusBar->showMessage(tr("Reconstructed image written")); ui->statusBar->showMessage(tr("Reconstructed image written"));
showMessage();
} }
void UEFITool::resizeTreeViewColums() void UEFITool::resizeTreeViewColums()
@ -250,12 +252,12 @@ void UEFITool::openImageFile(QString path)
init(); init();
UINT8 result = ffsEngine->parseInputFile(buffer); UINT8 result = ffsEngine->parseInputFile(buffer);
if (result) showMessage();
if (result)
ui->statusBar->showMessage(tr("Opened file can't be parsed (%1)").arg(result)); ui->statusBar->showMessage(tr("Opened file can't be parsed (%1)").arg(result));
else else
ui->statusBar->showMessage(tr("Opened: %1").arg(fileInfo.fileName())); ui->statusBar->showMessage(tr("Opened: %1").arg(fileInfo.fileName()));
showMessage();
resizeTreeViewColums(); resizeTreeViewColums();
} }
@ -344,9 +346,12 @@ void UEFITool::dropEvent(QDropEvent* event)
void UEFITool::showMessage() void UEFITool::showMessage()
{ {
ui->messageListWidget->clear(); ui->messageListWidget->clear();
QQueue<MessageListItem*> messageItems = ffsEngine->message(); if (!ffsEngine)
return;
messageItems = ffsEngine->message();
for (int i = 0; i < messageItems.count(); i++) { for (int i = 0; i < messageItems.count(); i++) {
ui->messageListWidget->addItem(messageItems.at(i)); ui->messageListWidget->addItem(new MessageListItem(messageItems.at(i)));
} }
} }

View File

@ -65,6 +65,7 @@ private slots:
private: private:
Ui::UEFITool * ui; Ui::UEFITool * ui;
FfsEngine* ffsEngine; FfsEngine* ffsEngine;
QQueue<MessageListItem> messageItems;
void dragEnterEvent(QDragEnterEvent* event); void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event); void dropEvent(QDropEvent* event);

View File

@ -20,7 +20,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>UEFITool 0.8.0</string> <string>UEFITool 0.8.1</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<property name="sizePolicy"> <property name="sizePolicy">