[accessibility/kmouth/release/26.08] phrasebook: PhraseBookDialog: do not leak UI instance
Friedrich W. H. Kossebau <[email protected]> Tue, 4 Aug 2026 15:45:58 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit a37d5958f90c23af05a613b252b8a8f6979e6dad by Friedrich W. H. Kossebau.
Committed on 04/08/2026 at 15:45.
Pushed by kossebau into branch 'release/26.08'.
PhraseBookDialog: do not leak UI instance
(cherry picked from commit 2739f2763048230c7f68617173a24f6ea568ccd3)
M +1 -1 phrasebook/phrasebookdialog.cpp
M +3 -1 phrasebook/phrasebookdialog.h
https://invent.kde.org/accessibility/kmouth/-/commit/a37d5958f90c23af05a613b252b8a8f6979e6dad
diff --git a/phrasebook/phrasebookdialog.cpp b/phrasebook/phrasebookdialog.cpp
index 3cdff63..78a7421 100644
--- a/phrasebook/phrasebookdialog.cpp
+++ b/phrasebook/phrasebookdialog.cpp
@@ -202,7 +202,7 @@ void PhraseBookDialog::initGUI()
{
QWidget *page = new QWidget(this);
- m_ui = new Ui::PhraseBookDialog();
+ m_ui = std::make_unique<Ui::PhraseBookDialog>();
m_ui->setupUi(page);
setCentralWidget(page);
diff --git a/phrasebook/phrasebookdialog.h b/phrasebook/phrasebookdialog.h
index 18c786b..22a6866 100644
--- a/phrasebook/phrasebookdialog.h
+++ b/phrasebook/phrasebookdialog.h
@@ -28,6 +28,8 @@
#include <QAction>
#include <QUrl>
+#include <memory>
+
// #include "phrasebook.h"
#include "ui_phrasebookdialog.h"
@@ -157,7 +159,7 @@ private:
// Keep QPrinter so settings persist
// QPrinter *printer;
- Ui::PhraseBookDialog *m_ui;
+ std::unique_ptr<Ui::PhraseBookDialog> m_ui;
};
#endif