Put XmlReportV2 object on the stack in ResultsView::readErrorsXml() (#1430)
Dynamic memory allocation was used for a XmlReportV2 object in the function “ResultsView::readErrorsXml”. This object was put on the stack instead so that this software became a bit safer and more efficient. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This commit is contained in:
parent
0a9be3e734
commit
937da6bd46
|
@ -331,21 +331,16 @@ void ResultsView::readErrorsXml(const QString &filename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlReport *report = new XmlReportV2(filename);
|
XmlReportV2 report(filename);
|
||||||
|
|
||||||
QList<ErrorItem> errors;
|
QList<ErrorItem> errors;
|
||||||
if (report) {
|
if (report.open()) {
|
||||||
if (report->open())
|
errors = report.read();
|
||||||
errors = report->read();
|
} else {
|
||||||
else {
|
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("Failed to read the report."));
|
msgBox.setText(tr("Failed to read the report."));
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
delete report;
|
|
||||||
report = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorItem item;
|
ErrorItem item;
|
||||||
foreach (item, errors) {
|
foreach (item, errors) {
|
||||||
|
|
Loading…
Reference in New Issue