From 70ed30f9e6b47fbfb3151078ca61a2bb419feccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 7 Apr 2019 23:59:04 +0200 Subject: GH-2591 less std::shared_ptr and more shared_qobject_ptr This eliminates some weird crashes. --- api/logic/tools/BaseProfiler.cpp | 3 ++- api/logic/tools/BaseProfiler.h | 5 +++-- api/logic/tools/JProfiler.cpp | 4 ++-- api/logic/tools/JVisualVM.cpp | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'api/logic/tools') diff --git a/api/logic/tools/BaseProfiler.cpp b/api/logic/tools/BaseProfiler.cpp index c7d83549..300d1a73 100644 --- a/api/logic/tools/BaseProfiler.cpp +++ b/api/logic/tools/BaseProfiler.cpp @@ -1,4 +1,5 @@ #include "BaseProfiler.h" +#include "QObjectPtr.h" #include @@ -7,7 +8,7 @@ BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QOb { } -void BaseProfiler::beginProfiling(std::shared_ptr process) +void BaseProfiler::beginProfiling(shared_qobject_ptr process) { beginProfilingImpl(process); } diff --git a/api/logic/tools/BaseProfiler.h b/api/logic/tools/BaseProfiler.h index f3e1ce3d..da817f52 100644 --- a/api/logic/tools/BaseProfiler.h +++ b/api/logic/tools/BaseProfiler.h @@ -1,6 +1,7 @@ #pragma once #include "BaseExternalTool.h" +#include "QObjectPtr.h" #include "multimc_logic_export.h" @@ -17,13 +18,13 @@ public: public slots: - void beginProfiling(std::shared_ptr process); + void beginProfiling(shared_qobject_ptr process); void abortProfiling(); protected: QProcess *m_profilerProcess; - virtual void beginProfilingImpl(std::shared_ptr process) = 0; + virtual void beginProfilingImpl(shared_qobject_ptr process) = 0; virtual void abortProfilingImpl(); signals: diff --git a/api/logic/tools/JProfiler.cpp b/api/logic/tools/JProfiler.cpp index b50322fe..1dc0d109 100644 --- a/api/logic/tools/JProfiler.cpp +++ b/api/logic/tools/JProfiler.cpp @@ -17,7 +17,7 @@ private slots: void profilerFinished(int exit, QProcess::ExitStatus status); protected: - void beginProfilingImpl(std::shared_ptr process); + void beginProfilingImpl(shared_qobject_ptr process); private: int listeningPort = 0; @@ -47,7 +47,7 @@ void JProfiler::profilerFinished(int exit, QProcess::ExitStatus status) } } -void JProfiler::beginProfilingImpl(std::shared_ptr process) +void JProfiler::beginProfilingImpl(shared_qobject_ptr process) { listeningPort = globalSettings->get("JProfilerPort").toInt(); QProcess *profiler = new QProcess(this); diff --git a/api/logic/tools/JVisualVM.cpp b/api/logic/tools/JVisualVM.cpp index 10886857..b1acc3c0 100644 --- a/api/logic/tools/JVisualVM.cpp +++ b/api/logic/tools/JVisualVM.cpp @@ -18,7 +18,7 @@ private slots: void profilerFinished(int exit, QProcess::ExitStatus status); protected: - void beginProfilingImpl(std::shared_ptr process); + void beginProfilingImpl(shared_qobject_ptr process); }; @@ -45,7 +45,7 @@ void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status) } } -void JVisualVM::beginProfilingImpl(std::shared_ptr process) +void JVisualVM::beginProfilingImpl(shared_qobject_ptr process) { QProcess *profiler = new QProcess(this); QStringList profilerArgs = -- cgit v1.2.3