diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-05-06 13:01:02 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-05-06 08:46:57 -0700 |
commit | 3e1ade5206853bbd95023ae79e62b5c608003352 (patch) | |
tree | e10285d8d3ae3766b9574d6fd0623be526ce1f3e | |
parent | b95ab84226d831c82c9aa8c43a29acba33d6ff7d (diff) | |
download | subsurface-3e1ade5206853bbd95023ae79e62b5c608003352.tar.gz |
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>
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 6 |
1 files 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 <img> tag |