Another attempt at fixing windows build

This commit is contained in:
Jan Dalheimer 2014-02-15 19:07:01 +01:00
parent c0e58fbfb2
commit 3b236483df
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,9 @@
#include "BaseProfiler.h" #include "BaseProfiler.h"
#include <QProcess> #include <QProcess>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent) BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent)
: QObject(parent), m_instance(instance) : QObject(parent), m_instance(instance)
@ -18,10 +21,11 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
qint64 BaseProfiler::pid(QProcess *process) qint64 BaseProfiler::pid(QProcess *process)
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_WIN
return process->pid(); struct _PROCESS_INFORMATION *procinfo = process->pid();
return procinfo->dwProcessId;
#else #else
return (qint64)process->pid(); return process->pid();
#endif #endif
} }

View File

@ -14,7 +14,7 @@ JVisualVM::JVisualVM(OneSixInstance *instance, QObject *parent) : BaseProfiler(i
void JVisualVM::beginProfilingImpl(MinecraftProcess *process) void JVisualVM::beginProfilingImpl(MinecraftProcess *process)
{ {
QProcess *profiler = new QProcess(this); QProcess *profiler = new QProcess(this);
profiler->setArguments(QStringList() << "--openpid" << QString::number(process->pid())); profiler->setArguments(QStringList() << "--openpid" << QString::number(pid(process)));
profiler->setProgram("jvisualvm"); profiler->setProgram("jvisualvm");
connect(profiler, &QProcess::started, [this]() connect(profiler, &QProcess::started, [this]()
{ emit readyToLaunch(tr("JVisualVM started")); }); { emit readyToLaunch(tr("JVisualVM started")); });