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;
|
||||
}
|
||||
|
||||
XmlReport *report = new XmlReportV2(filename);
|
||||
|
||||
XmlReportV2 report(filename);
|
||||
QList<ErrorItem> errors;
|
||||
if (report) {
|
||||
if (report->open())
|
||||
errors = report->read();
|
||||
else {
|
||||
if (report.open()) {
|
||||
errors = report.read();
|
||||
} else {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("Failed to read the report."));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.exec();
|
||||
}
|
||||
delete report;
|
||||
report = NULL;
|
||||
}
|
||||
|
||||
ErrorItem item;
|
||||
foreach (item, errors) {
|
||||
|
|
Loading…
Reference in New Issue