From 3e1ade5206853bbd95023ae79e62b5c608003352 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 6 May 2021 13:01:02 +0200 Subject: [PATCH] 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 --- desktop-widgets/diveplanner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 13f540124..7244039b6 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -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 tag