GH-2591 less std::shared_ptr and more shared_qobject_ptr

This eliminates some weird crashes.
This commit is contained in:
Petr Mrázek
2019-04-07 23:59:04 +02:00
parent 414946cad9
commit 70ed30f9e6
25 changed files with 79 additions and 83 deletions

View File

@ -1,4 +1,5 @@
#include "BaseProfiler.h"
#include "QObjectPtr.h"
#include <QProcess>
@ -7,7 +8,7 @@ BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QOb
{
}
void BaseProfiler::beginProfiling(std::shared_ptr<LaunchTask> process)
void BaseProfiler::beginProfiling(shared_qobject_ptr<LaunchTask> process)
{
beginProfilingImpl(process);
}

View File

@ -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<LaunchTask> process);
void beginProfiling(shared_qobject_ptr<LaunchTask> process);
void abortProfiling();
protected:
QProcess *m_profilerProcess;
virtual void beginProfilingImpl(std::shared_ptr<LaunchTask> process) = 0;
virtual void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process) = 0;
virtual void abortProfilingImpl();
signals:

View File

@ -17,7 +17,7 @@ private slots:
void profilerFinished(int exit, QProcess::ExitStatus status);
protected:
void beginProfilingImpl(std::shared_ptr<LaunchTask> process);
void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process);
private:
int listeningPort = 0;
@ -47,7 +47,7 @@ void JProfiler::profilerFinished(int exit, QProcess::ExitStatus status)
}
}
void JProfiler::beginProfilingImpl(std::shared_ptr<LaunchTask> process)
void JProfiler::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process)
{
listeningPort = globalSettings->get("JProfilerPort").toInt();
QProcess *profiler = new QProcess(this);

View File

@ -18,7 +18,7 @@ private slots:
void profilerFinished(int exit, QProcess::ExitStatus status);
protected:
void beginProfilingImpl(std::shared_ptr<LaunchTask> process);
void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process);
};
@ -45,7 +45,7 @@ void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status)
}
}
void JVisualVM::beginProfilingImpl(std::shared_ptr<LaunchTask> process)
void JVisualVM::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process)
{
QProcess *profiler = new QProcess(this);
QStringList profilerArgs =