More fixes.
This commit is contained in:
parent
82b35b5445
commit
994972bf5d
@ -1256,7 +1256,7 @@ void MainWindow::launchInstance(BaseInstance *instance, AuthSessionPtr session,
|
|||||||
dialog.setMaximum(0);
|
dialog.setMaximum(0);
|
||||||
dialog.setValue(0);
|
dialog.setValue(0);
|
||||||
dialog.setLabelText(tr("Waiting for profiler..."));
|
dialog.setLabelText(tr("Waiting for profiler..."));
|
||||||
connect(&dialog, &QDialog::rejected, profilerInstance, &BaseProfiler::abortProfiling);
|
connect(&dialog, &QProgressDialog::canceled, profilerInstance, &BaseProfiler::abortProfiling);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
connect(profilerInstance, &BaseProfiler::readyToLaunch, [&dialog, this](const QString &message)
|
connect(profilerInstance, &BaseProfiler::readyToLaunch, [&dialog, this](const QString &message)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
|
|||||||
|
|
||||||
void BaseProfiler::abortProfiling()
|
void BaseProfiler::abortProfiling()
|
||||||
{
|
{
|
||||||
abortProfiling();
|
abortProfilingImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseProfiler::abortProfilingImpl()
|
void BaseProfiler::abortProfilingImpl()
|
||||||
@ -32,6 +32,8 @@ void BaseProfiler::abortProfilingImpl()
|
|||||||
}
|
}
|
||||||
m_profilerProcess->terminate();
|
m_profilerProcess->terminate();
|
||||||
m_profilerProcess->deleteLater();
|
m_profilerProcess->deleteLater();
|
||||||
|
m_profilerProcess = 0;
|
||||||
|
emit abortLaunch(tr("Profiler aborted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 BaseProfiler::pid(QProcess *process)
|
qint64 BaseProfiler::pid(QProcess *process)
|
||||||
|
@ -26,13 +26,18 @@ void JProfiler::beginProfilingImpl(MinecraftProcess *process)
|
|||||||
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
||||||
[this](int exit, QProcess::ExitStatus status)
|
[this](int exit, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
if (exit != 0 || status == QProcess::CrashExit)
|
if (status == QProcess::CrashExit)
|
||||||
{
|
{
|
||||||
emit abortLaunch(tr("Profiler aborted"));
|
emit abortLaunch(tr("Profiler aborted"));
|
||||||
}
|
}
|
||||||
|
if (m_profilerProcess)
|
||||||
|
{
|
||||||
m_profilerProcess->deleteLater();
|
m_profilerProcess->deleteLater();
|
||||||
|
m_profilerProcess = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
profiler->start();
|
profiler->start();
|
||||||
|
m_profilerProcess = profiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JProfilerFactory::registerSettings(SettingsObject *settings)
|
void JProfilerFactory::registerSettings(SettingsObject *settings)
|
||||||
|
@ -16,7 +16,7 @@ void JVisualVM::beginProfilingImpl(MinecraftProcess *process)
|
|||||||
{
|
{
|
||||||
QProcess *profiler = new QProcess(this);
|
QProcess *profiler = new QProcess(this);
|
||||||
profiler->setArguments(QStringList() << "--openpid" << QString::number(pid(process)));
|
profiler->setArguments(QStringList() << "--openpid" << QString::number(pid(process)));
|
||||||
profiler->setProgram("jvisualvm");
|
profiler->setProgram(MMC->settings()->get("JVisualVMPath").toString());
|
||||||
connect(profiler, &QProcess::started, [this]()
|
connect(profiler, &QProcess::started, [this]()
|
||||||
{ emit readyToLaunch(tr("JVisualVM started")); });
|
{ emit readyToLaunch(tr("JVisualVM started")); });
|
||||||
connect(profiler,
|
connect(profiler,
|
||||||
@ -27,7 +27,11 @@ void JVisualVM::beginProfilingImpl(MinecraftProcess *process)
|
|||||||
{
|
{
|
||||||
emit abortLaunch(tr("Profiler aborted"));
|
emit abortLaunch(tr("Profiler aborted"));
|
||||||
}
|
}
|
||||||
|
if (m_profilerProcess)
|
||||||
|
{
|
||||||
m_profilerProcess->deleteLater();
|
m_profilerProcess->deleteLater();
|
||||||
|
m_profilerProcess = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
profiler->start();
|
profiler->start();
|
||||||
m_profilerProcess = profiler;
|
m_profilerProcess = profiler;
|
||||||
|
Loading…
Reference in New Issue
Block a user