diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-03-02 09:41:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-03-05 12:34:01 (GMT) |
commit | 9de0355d4f8f56a71f3d18b1b2c3d50dc8624aae (patch) | |
tree | ec6050654d073ec970e81fe51d95cf0110d02efd /Source/QtDialog/CMakeSetupDialog.cxx | |
parent | 07a7bc0e3fc370eaa5593cffcd07c0ea739cfc9c (diff) | |
download | CMake-9de0355d4f8f56a71f3d18b1b2c3d50dc8624aae.zip CMake-9de0355d4f8f56a71f3d18b1b2c3d50dc8624aae.tar.gz CMake-9de0355d4f8f56a71f3d18b1b2c3d50dc8624aae.tar.bz2 |
Modernize memory management
Update internals of various classes.
Diffstat (limited to 'Source/QtDialog/CMakeSetupDialog.cxx')
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 436a904..276bf64 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "CMakeSetupDialog.h" +#include <cm/memory> + #include <QCloseEvent> #include <QCoreApplication> #include <QDesktopServices> @@ -39,23 +41,21 @@ QCMakeThread::QCMakeThread(QObject* p) : QThread(p) - , CMakeInstance(nullptr) { } QCMake* QCMakeThread::cmakeInstance() const { - return this->CMakeInstance; + return this->CMakeInstance.get(); } void QCMakeThread::run() { - this->CMakeInstance = new QCMake; + this->CMakeInstance = cm::make_unique<QCMake>(); // emit that this cmake thread is ready for use emit this->cmakeInitialized(); this->exec(); - delete this->CMakeInstance; - this->CMakeInstance = nullptr; + this->CMakeInstance.reset(); } CMakeSetupDialog::CMakeSetupDialog() @@ -1206,7 +1206,7 @@ void CMakeSetupDialog::setSearchFilter(const QString& str) void CMakeSetupDialog::doOutputContextMenu(QPoint pt) { - QMenu* menu = this->Output->createStandardContextMenu(); + std::unique_ptr<QMenu> menu(this->Output->createStandardContextMenu()); menu->addSeparator(); menu->addAction(tr("Find..."), this, SLOT(doOutputFindDialog()), @@ -1220,7 +1220,6 @@ void CMakeSetupDialog::doOutputContextMenu(QPoint pt) QKeySequence(Qt::Key_F8)); menu->exec(this->Output->mapToGlobal(pt)); - delete menu; } void CMakeSetupDialog::doOutputFindDialog() |