CtfVisualizer: Destroy CtfTool earlier again

Amends 796053d7.

After all, the defaulted destructor of the class did some actual work
via the destructors of the QScopedPointer members.

Change-Id: If6dc8a3d57961ec263fced11f9fa9f7e9f8c54cc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-12 18:34:46 +01:00
parent eeb8bf1ddf
commit 14ede71d62
3 changed files with 8 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ class CtfVisualizerPlugin : public ExtensionSystem::IPlugin
void initialize() final void initialize() final
{ {
setupCtfVisualizerTool(); setupCtfVisualizerTool(this);
} }
}; };

View File

@@ -35,8 +35,9 @@ namespace CtfVisualizer::Internal {
using json = nlohmann::json; using json = nlohmann::json;
CtfVisualizerTool::CtfVisualizerTool() CtfVisualizerTool::CtfVisualizerTool(QObject *parent)
: m_modelAggregator(new Timeline::TimelineModelAggregator(this)) : QObject(parent)
, m_modelAggregator(new Timeline::TimelineModelAggregator(this))
, m_zoomControl(new Timeline::TimelineZoomControl(this)) , m_zoomControl(new Timeline::TimelineZoomControl(this))
, m_statisticsModel(new CtfStatisticsModel(this)) , m_statisticsModel(new CtfStatisticsModel(this))
, m_traceManager(new CtfTraceManager(this, m_modelAggregator.get(), m_statisticsModel.get())) , m_traceManager(new CtfTraceManager(this, m_modelAggregator.get(), m_statisticsModel.get()))
@@ -251,9 +252,9 @@ void CtfVisualizerTool::loadJson(const QString &fileName)
m_loader->start(); m_loader->start();
} }
void setupCtfVisualizerTool() void setupCtfVisualizerTool(QObject *guard)
{ {
static CtfVisualizerTool theCtfVisualizerTool; (void) new CtfVisualizerTool(guard);
} }
} // namespace CtfVisualizer::Internal } // namespace CtfVisualizer::Internal

View File

@@ -28,7 +28,7 @@ class CtfVisualizerTool : public QObject
Q_OBJECT Q_OBJECT
public: public:
CtfVisualizerTool(); explicit CtfVisualizerTool(QObject *parent);
~CtfVisualizerTool(); ~CtfVisualizerTool();
Timeline::TimelineModelAggregator *modelAggregator() const; Timeline::TimelineModelAggregator *modelAggregator() const;
@@ -66,6 +66,6 @@ private:
QMenu *const m_restrictToThreadsMenu; QMenu *const m_restrictToThreadsMenu;
}; };
void setupCtfVisualizerTool(); void setupCtfVisualizerTool(QObject *guard);
} // namespace CtfVisualizer::Internal } // namespace CtfVisualizer::Internal