[accessibility/kmouth] phrasebook: PhraseBookDialog: do not leak UI instance
Friedrich W. H. Kossebau <[email protected]> Tue, 4 Aug 2026 15:44:07 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 2739f2763048230c7f68617173a24f6ea568ccd3 by Friedrich W. H. Kossebau.
Committed on 04/08/2026 at 15:40.
Pushed by kossebau into branch 'master'.
PhraseBookDialog: do not leak UI instance
M +1 -1 phrasebook/phrasebookdialog.cpp
M +3 -1 phrasebook/phrasebookdialog.h
https://invent.kde.org/accessibility/kmouth/-/commit/2739f2763048230c7f68617173a24f6ea568ccd3
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