cleanup: free print dialog in planner

When printing the plan, a print-dialog was created with "new",
but not freed later. Strictly speaking, this is not a leak,
because the dialog is attached to the main-window in Qt's
object hierarchy. Thus it is freed on application exit. On
the other hand, it is a leak in the sense that resources are
pointlessly hogged until application exit.

Let's just turn it into a stack-allocated object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-05-06 13:01:02 +02:00 committed by Dirk Hohndel
parent b95ab84226
commit 3e1ade5206

View file

@ -588,9 +588,9 @@ void PlannerWidgets::printDecoPlan()
free(disclaimer);
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog(&printer, MainWindow::instance());
dialog->setWindowTitle(tr("Print runtime table"));
if (dialog->exec() != QDialog::Accepted)
QPrintDialog dialog(&printer, MainWindow::instance());
dialog.setWindowTitle(tr("Print runtime table"));
if (dialog.exec() != QDialog::Accepted)
return;
/* render the profile as a pixmap that is inserted as base64 data into a HTML <img> tag