summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/MainWindow.cpp2
-rw-r--r--logic/profiler/BaseProfiler.cpp4
-rw-r--r--logic/profiler/JProfiler.cpp9
-rw-r--r--logic/profiler/JVisualVM.cpp8
4 files changed, 17 insertions, 6 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index b28e753f..b05c58f7 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -1256,7 +1256,7 @@ void MainWindow::launchInstance(BaseInstance *instance, AuthSessionPtr session,
dialog.setMaximum(0);
dialog.setValue(0);
dialog.setLabelText(tr("Waiting for profiler..."));
- connect(&dialog, &QDialog::rejected, profilerInstance, &BaseProfiler::abortProfiling);
+ connect(&dialog, &QProgressDialog::canceled, profilerInstance, &BaseProfiler::abortProfiling);
dialog.show();
connect(profilerInstance, &BaseProfiler::readyToLaunch, [&dialog, this](const QString &message)
{
diff --git a/logic/profiler/BaseProfiler.cpp b/logic/profiler/BaseProfiler.cpp
index 1a377818..b58e88be 100644
--- a/logic/profiler/BaseProfiler.cpp
+++ b/logic/profiler/BaseProfiler.cpp
@@ -21,7 +21,7 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
void BaseProfiler::abortProfiling()
{
- abortProfiling();
+ abortProfilingImpl();
}
void BaseProfiler::abortProfilingImpl()
@@ -32,6 +32,8 @@ void BaseProfiler::abortProfilingImpl()
}
m_profilerProcess->terminate();
m_profilerProcess->deleteLater();
+ m_profilerProcess = 0;
+ emit abortLaunch(tr("Profiler aborted"));
}
qint64 BaseProfiler::pid(QProcess *process)
diff --git a/logic/profiler/JProfiler.cpp b/logic/profiler/JProfiler.cpp
index 34f927ce..1cd8d128 100644
--- a/logic/profiler/JProfiler.cpp
+++ b/logic/profiler/JProfiler.cpp
@@ -26,13 +26,18 @@ void JProfiler::beginProfilingImpl(MinecraftProcess *process)
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
[this](int exit, QProcess::ExitStatus status)
{
- if (exit != 0 || status == QProcess::CrashExit)
+ if (status == QProcess::CrashExit)
{
emit abortLaunch(tr("Profiler aborted"));
}
- m_profilerProcess->deleteLater();
+ if (m_profilerProcess)
+ {
+ m_profilerProcess->deleteLater();
+ m_profilerProcess = 0;
+ }
});
profiler->start();
+ m_profilerProcess = profiler;
}
void JProfilerFactory::registerSettings(SettingsObject *settings)
diff --git a/logic/profiler/JVisualVM.cpp b/logic/profiler/JVisualVM.cpp
index 89098f73..c4bc851b 100644
--- a/logic/profiler/JVisualVM.cpp
+++ b/logic/profiler/JVisualVM.cpp
@@ -16,7 +16,7 @@ void JVisualVM::beginProfilingImpl(MinecraftProcess *process)
{
QProcess *profiler = new QProcess(this);
profiler->setArguments(QStringList() << "--openpid" << QString::number(pid(process)));
- profiler->setProgram("jvisualvm");
+ profiler->setProgram(MMC->settings()->get("JVisualVMPath").toString());
connect(profiler, &QProcess::started, [this]()
{ emit readyToLaunch(tr("JVisualVM started")); });
connect(profiler,
@@ -27,7 +27,11 @@ void JVisualVM::beginProfilingImpl(MinecraftProcess *process)
{
emit abortLaunch(tr("Profiler aborted"));
}
- m_profilerProcess->deleteLater();
+ if (m_profilerProcess)
+ {
+ m_profilerProcess->deleteLater();
+ m_profilerProcess = 0;
+ }
});
profiler->start();
m_profilerProcess = profiler;