diff options
author | Montel Laurent <kdeqt@yahoo.fr> | 2012-11-30 12:50:53 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-30 23:56:02 +0100 |
commit | c565ef6d72ea4b95cfc72edbb67af27f8ef35fb5 (patch) | |
tree | 3c4395624a8a789226d55f58c31b274412bd41ef /examples/widgets/richtext/orderform/mainwindow.cpp | |
parent | 930207fc1f66566d563b820af5d2efc7bec3b610 (diff) |
Fix memory leak. PrinterDialog is not deleted when close it
Change-Id: I9f0a300cdaf9803bc2ad723946ac4d0f825cc28b
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'examples/widgets/richtext/orderform/mainwindow.cpp')
-rw-r--r-- | examples/widgets/richtext/orderform/mainwindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/widgets/richtext/orderform/mainwindow.cpp b/examples/widgets/richtext/orderform/mainwindow.cpp index 4334e8bb71..e6e7e3bd6f 100644 --- a/examples/widgets/richtext/orderform/mainwindow.cpp +++ b/examples/widgets/richtext/orderform/mainwindow.cpp @@ -240,12 +240,13 @@ void MainWindow::printFile() //! [18] QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); + QPrintDialog dialog(&printer, this); + dialog.setWindowTitle(tr("Print Document")); if (editor->textCursor().hasSelection()) - dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection); - if (dialog->exec() != QDialog::Accepted) + dialog.addEnabledOption(QAbstractPrintDialog::PrintSelection); + if (dialog.exec() != QDialog::Accepted) { return; + } //! [18] editor->print(&printer); |