diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-04 16:12:55 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-05 14:49:01 +0000 |
commit | 4e58ffcd1397f85e368c9862564564f4e44ed403 (patch) | |
tree | 791dee2ee4db5df512052a33e9ec4ba63fc7bc22 | |
parent | 2f39b51bdc1f73e2d87cc641a8501fd04ee76b4f (diff) | |
download | qt-creator-4e58ffcd1397f85e368c9862564564f4e44ed403.tar.gz |
Task/ProcessProgress: Delete private data on destruction
Change-Id: I81787984ff8dbb541f88922c90e51a68184c392b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
4 files changed, 17 insertions, 14 deletions
diff --git a/src/plugins/coreplugin/progressmanager/processprogress.cpp b/src/plugins/coreplugin/progressmanager/processprogress.cpp index d2109f072a..f2d37767ce 100644 --- a/src/plugins/coreplugin/progressmanager/processprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/processprogress.cpp @@ -107,6 +107,8 @@ ProcessProgress::ProcessProgress(QtcProcess *process) }); } +ProcessProgress::~ProcessProgress() = default; + void ProcessProgress::setDisplayName(const QString &name) { d->m_displayName = name; @@ -123,9 +125,9 @@ void ProcessProgress::setProgressParser(const ProgressParser &parser) { if (d->m_parser) { disconnect(d->m_process, &QtcProcess::textOnStandardOutput, - d, &ProcessProgressPrivate::parseProgress); + d.get(), &ProcessProgressPrivate::parseProgress); disconnect(d->m_process, &QtcProcess::textOnStandardError, - d, &ProcessProgressPrivate::parseProgress); + d.get(), &ProcessProgressPrivate::parseProgress); } d->m_parser = parser; if (!d->m_parser) @@ -136,9 +138,9 @@ void ProcessProgress::setProgressParser(const ProgressParser &parser) "text channel mode is no-op."); connect(d->m_process, &QtcProcess::textOnStandardOutput, - d, &ProcessProgressPrivate::parseProgress); + d.get(), &ProcessProgressPrivate::parseProgress); connect(d->m_process, &QtcProcess::textOnStandardError, - d, &ProcessProgressPrivate::parseProgress); + d.get(), &ProcessProgressPrivate::parseProgress); } } // namespace Core diff --git a/src/plugins/coreplugin/progressmanager/processprogress.h b/src/plugins/coreplugin/progressmanager/processprogress.h index d6e1721622..339a4fd173 100644 --- a/src/plugins/coreplugin/progressmanager/processprogress.h +++ b/src/plugins/coreplugin/progressmanager/processprogress.h @@ -3,14 +3,11 @@ #pragma once -#include <coreplugin/core_global.h> +#include "../core_global.h" -#include <QObject> +#include "futureprogress.h" -QT_BEGIN_NAMESPACE -template <typename T> -class QFutureInterface; -QT_END_NAMESPACE +#include <QObject> namespace Utils { class QtcProcess; } @@ -24,13 +21,14 @@ class CORE_EXPORT ProcessProgress : public QObject { public: ProcessProgress(Utils::QtcProcess *process); // Makes ProcessProgress a child of process + ~ProcessProgress() override; void setDisplayName(const QString &name); void setKeepOnFinish(FutureProgress::KeepOnFinishType keepType); void setProgressParser(const ProgressParser &parser); private: - ProcessProgressPrivate *d; + std::unique_ptr<ProcessProgressPrivate> d; }; } // namespace Core diff --git a/src/plugins/coreplugin/progressmanager/taskprogress.cpp b/src/plugins/coreplugin/progressmanager/taskprogress.cpp index 2d7509aaab..3e75ece502 100644 --- a/src/plugins/coreplugin/progressmanager/taskprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/taskprogress.cpp @@ -131,6 +131,8 @@ TaskProgress::TaskProgress(TaskTree *taskTree) }); } +TaskProgress::~TaskProgress() = default; + void TaskProgress::setHalfLifeTimePerTask(int msecs) { d->m_halfLifeTimePerTask = msecs; diff --git a/src/plugins/coreplugin/progressmanager/taskprogress.h b/src/plugins/coreplugin/progressmanager/taskprogress.h index 318dc2ab8a..e9dab64124 100644 --- a/src/plugins/coreplugin/progressmanager/taskprogress.h +++ b/src/plugins/coreplugin/progressmanager/taskprogress.h @@ -3,9 +3,9 @@ #pragma once -#include <coreplugin/core_global.h> +#include "../core_global.h" -#include "futureprogress.h" // TODO: just because of KeepOnFinishType enum - move it outside +#include "futureprogress.h" #include <QObject> @@ -19,6 +19,7 @@ class CORE_EXPORT TaskProgress : public QObject { public: TaskProgress(Utils::TaskTree *taskTree); // Makes TaskProgress a child of task tree + ~TaskProgress() override; void setHalfLifeTimePerTask(int msecs); // Default is 1000 ms void setDisplayName(const QString &name); @@ -27,7 +28,7 @@ public: void setSubtitle(const QString &subtitle); private: - TaskProgressPrivate *d; + std::unique_ptr<TaskProgressPrivate> d; }; } // namespace Core |