diff --git a/src/plugins/clangtools/clangtidyclazytool.cpp b/src/plugins/clangtools/clangtidyclazytool.cpp index 3e01f2dea02..059f9a2d53b 100644 --- a/src/plugins/clangtools/clangtidyclazytool.cpp +++ b/src/plugins/clangtools/clangtidyclazytool.cpp @@ -203,7 +203,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() m_diagnosticFilterModel = new DiagnosticFilterModel(this); m_diagnosticFilterModel->setSourceModel(m_diagnosticModel); - m_diagnosticView = std::make_unique(); + m_diagnosticView = new DiagnosticView; initDiagnosticView(); m_diagnosticView->setModel(m_diagnosticFilterModel); m_diagnosticView->setObjectName(QLatin1String("ClangTidyClazyIssuesView")); @@ -226,7 +226,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() action->setDisabled(true); action->setIcon(Utils::Icons::PREV_TOOLBAR.icon()); action->setToolTip(tr("Go to previous diagnostic.")); - connect(action, &QAction::triggered, m_diagnosticView.get(), &DetailedErrorView::goBack); + connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goBack); m_goBack = action; // Go to next diagnostic @@ -234,7 +234,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() action->setDisabled(true); action->setIcon(Utils::Icons::NEXT_TOOLBAR.icon()); action->setToolTip(tr("Go to next diagnostic.")); - connect(action, &QAction::triggered, m_diagnosticView.get(), &DetailedErrorView::goNext); + connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goNext); m_goNext = action; // Filter line edit @@ -254,7 +254,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() &ClangToolsDiagnosticModel::fixItsToApplyCountChanged, [this](int c) { m_applyFixitsButton->setEnabled(c); - static_cast(m_diagnosticView.get())->setSelectedFixItsCount(c); + static_cast(m_diagnosticView.data())->setSelectedFixItsCount(c); }); connect(m_applyFixitsButton, &QToolButton::clicked, [this]() { QVector diagnosticItems; @@ -270,7 +270,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() "Clang project to search for errors and warnings."); auto perspective = new Perspective(tr("Clang-Tidy and Clazy")); - perspective->addWindow(m_diagnosticView.get(), Perspective::SplitVertical, nullptr); + perspective->addWindow(m_diagnosticView, Perspective::SplitVertical, nullptr); Debugger::registerPerspective(ClangTidyClazyPerspectiveId, perspective); action = new QAction(tr("Clang-Tidy and Clazy..."), this); diff --git a/src/plugins/clangtools/clangtool.cpp b/src/plugins/clangtools/clangtool.cpp index dfc96585259..da23b619fd1 100644 --- a/src/plugins/clangtools/clangtool.cpp +++ b/src/plugins/clangtools/clangtool.cpp @@ -98,7 +98,10 @@ ClangTool::ClangTool(const QString &name) m_stopAction = Debugger::createStopAction(); } -ClangTool::~ClangTool() = default; +ClangTool::~ClangTool() +{ + delete m_diagnosticView; +} FileInfos ClangTool::collectFileInfos(Project *project, bool askUserForFileSelection) const { diff --git a/src/plugins/clangtools/clangtool.h b/src/plugins/clangtools/clangtool.h index 385c63a5cc1..39d66b7e737 100644 --- a/src/plugins/clangtools/clangtool.h +++ b/src/plugins/clangtools/clangtool.h @@ -72,7 +72,7 @@ protected: void initDiagnosticView(); ClangToolsDiagnosticModel *m_diagnosticModel = nullptr; - std::unique_ptr m_diagnosticView; + QPointer m_diagnosticView; QAction *m_startAction = nullptr; QAction *m_stopAction = nullptr; diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 75ae430e296..71e251d7873 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -182,10 +182,10 @@ public: QSortFilterProxyModel m_calleesProxy; // Callgrind widgets - std::unique_ptr m_flatView; - std::unique_ptr m_callersView; - std::unique_ptr m_calleesView; - std::unique_ptr m_visualization; + QPointer m_flatView; + QPointer m_callersView; + QPointer m_calleesView; + QPointer m_visualization; // Navigation QAction *m_goBack = nullptr; @@ -307,15 +307,15 @@ CallgrindTool::CallgrindTool() // // DockWidgets // - m_visualization = std::make_unique(); + m_visualization = new Visualization; m_visualization->setFrameStyle(QFrame::NoFrame); m_visualization->setObjectName(QLatin1String("Valgrind.CallgrindTool.Visualisation")); m_visualization->setWindowTitle(tr("Visualization")); m_visualization->setModel(&m_dataModel); - connect(m_visualization.get(), &Visualization::functionActivated, + connect(m_visualization, &Visualization::functionActivated, this, &CallgrindTool::visualisationFunctionSelected); - m_callersView = std::make_unique(); + m_callersView = new CostView; m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView")); m_callersView->setWindowTitle(tr("Callers")); m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView"); @@ -325,10 +325,10 @@ CallgrindTool::CallgrindTool() m_callersProxy.setSourceModel(&m_callersModel); m_callersView->setModel(&m_callersProxy); m_callersView->hideColumn(CallModel::CalleeColumn); - connect(m_callersView.get(), &QAbstractItemView::activated, + connect(m_callersView, &QAbstractItemView::activated, this, &CallgrindTool::callerFunctionSelected); - m_calleesView = std::make_unique(); + m_calleesView = new CostView; m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView")); m_calleesView->setWindowTitle(tr("Callees")); m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView"); @@ -338,10 +338,10 @@ CallgrindTool::CallgrindTool() m_calleesProxy.setSourceModel(&m_calleesModel); m_calleesView->setModel(&m_calleesProxy); m_calleesView->hideColumn(CallModel::CallerColumn); - connect(m_calleesView.get(), &QAbstractItemView::activated, + connect(m_calleesView, &QAbstractItemView::activated, this, &CallgrindTool::calleeFunctionSelected); - m_flatView = std::make_unique(); + m_flatView = new CostView; m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView")); m_flatView->setWindowTitle(tr("Functions")); m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView"); @@ -349,7 +349,7 @@ CallgrindTool::CallgrindTool() m_flatView->setFrameStyle(QFrame::NoFrame); m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false); m_flatView->setModel(&m_proxyModel); - connect(m_flatView.get(), &QAbstractItemView::activated, + connect(m_flatView, &QAbstractItemView::activated, this, &CallgrindTool::dataFunctionSelected); updateCostFormat(); @@ -507,10 +507,10 @@ CallgrindTool::CallgrindTool() Debugger::registerToolbar(CallgrindPerspectiveId, toolbar); auto perspective = new Perspective(tr("Callgrind")); - perspective->addWindow(m_flatView.get(), Perspective::SplitVertical, nullptr); - perspective->addWindow(m_calleesView.get(), Perspective::SplitVertical, nullptr); - perspective->addWindow(m_callersView.get(), Perspective::SplitHorizontal, m_calleesView.get()); - perspective->addWindow(m_visualization.get(), Perspective::SplitVertical, nullptr, + perspective->addWindow(m_flatView, Perspective::SplitVertical, nullptr); + perspective->addWindow(m_calleesView, Perspective::SplitVertical, nullptr); + perspective->addWindow(m_callersView, Perspective::SplitHorizontal, m_calleesView); + perspective->addWindow(m_visualization, Perspective::SplitVertical, nullptr, false, Qt::RightDockWidgetArea); Debugger::registerPerspective(CallgrindPerspectiveId, perspective); @@ -521,6 +521,10 @@ CallgrindTool::CallgrindTool() CallgrindTool::~CallgrindTool() { qDeleteAll(m_textMarks); + delete m_flatView; + delete m_callersView; + delete m_calleesView; + delete m_visualization; } void CallgrindTool::doClear(bool clearParseData) diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 1efd8c3a6f4..bf91eeb2b44 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -391,6 +391,7 @@ class MemcheckTool : public QObject public: MemcheckTool(); + ~MemcheckTool(); void setupRunner(MemcheckToolRunner *runTool); void loadShowXmlLogFile(const QString &filePath, const QString &exitMsg); @@ -424,7 +425,7 @@ private: Valgrind::XmlProtocol::ErrorListModel m_errorModel; MemcheckErrorFilterProxyModel m_errorProxyModel; - std::unique_ptr m_errorView; + QPointer m_errorView; QList m_errorFilterActions; QAction *m_filterProjectAction; @@ -539,7 +540,7 @@ MemcheckTool::MemcheckTool() initKindFilterAction(a, { InvalidFree, MismatchedFree }); m_errorFilterActions.append(a); - m_errorView = std::make_unique(); + m_errorView = new MemcheckErrorView; m_errorView->setObjectName(QLatin1String("MemcheckErrorView")); m_errorView->setFrameStyle(QFrame::NoFrame); m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false); @@ -556,7 +557,7 @@ MemcheckTool::MemcheckTool() m_errorView->setWindowTitle(tr("Memory Issues")); auto perspective = new Perspective(tr("Memcheck")); - perspective->addWindow(m_errorView.get(), Perspective::SplitVertical, nullptr); + perspective->addWindow(m_errorView, Perspective::SplitVertical, nullptr); Debugger::registerPerspective(MemcheckPerspectiveId, perspective); connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions, @@ -582,7 +583,7 @@ MemcheckTool::MemcheckTool() action->setDisabled(true); action->setIcon(Icons::PREV_TOOLBAR.icon()); action->setToolTip(tr("Go to previous leak.")); - connect(action, &QAction::triggered, m_errorView.get(), &MemcheckErrorView::goBack); + connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goBack); m_goBack = action; // Go to next leak. @@ -590,7 +591,7 @@ MemcheckTool::MemcheckTool() action->setDisabled(true); action->setIcon(Icons::NEXT_TOOLBAR.icon()); action->setToolTip(tr("Go to next leak.")); - connect(action, &QAction::triggered, m_errorView.get(), &MemcheckErrorView::goNext); + connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goNext); m_goNext = action; auto filterButton = new QToolButton; @@ -697,6 +698,11 @@ MemcheckTool::MemcheckTool() maybeActiveRunConfigurationChanged(); } +MemcheckTool::~MemcheckTool() +{ + delete m_errorView; +} + void MemcheckTool::heobAction() { #ifdef Q_OS_WIN