From ff78b5a6c20aac5ef81fbe73a42f00aa801bfcb4 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Wed, 21 Oct 2020 12:05:32 +0200 Subject: [PATCH] XMRig: fix stop on windows --- src/utils/xmrig.cpp | 12 ++++++------ src/utils/xmrig.h | 1 - src/widgets/xmrigwidget.cpp | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utils/xmrig.cpp b/src/utils/xmrig.cpp index dc03ea5..42cc0a1 100644 --- a/src/utils/xmrig.cpp +++ b/src/utils/xmrig.cpp @@ -32,13 +32,13 @@ void XmRig::prepare() { } void XmRig::stop() { - if(m_process.state() == QProcess::Running) - m_process.kill(); -} - -void XmRig::terminate() { - if(m_process.state() == QProcess::Running) + if(m_process.state() == QProcess::Running) { +#if defined(Q_OS_WIN) + m_process.kill(); // https://doc.qt.io/qt-5/qprocess.html#terminate +#else m_process.terminate(); +#endif + } } void XmRig::start(const QString &path, diff --git a/src/utils/xmrig.h b/src/utils/xmrig.h index 46e5b20..0835947 100644 --- a/src/utils/xmrig.h +++ b/src/utils/xmrig.h @@ -25,7 +25,6 @@ public: void start(const QString &path, unsigned int threads, const QString &address, const QString &username, const QString &password, bool tor = false, bool tls = true); void stop(); - void terminate(); bool unpackBins(); QString rigDir; diff --git a/src/widgets/xmrigwidget.cpp b/src/widgets/xmrigwidget.cpp index 4d541cf..e3be655 100644 --- a/src/widgets/xmrigwidget.cpp +++ b/src/widgets/xmrigwidget.cpp @@ -185,7 +185,7 @@ void XMRigWidget::onStartClicked() { } void XMRigWidget::onStopClicked() { - m_ctx->XMRig->terminate(); + m_ctx->XMRig->stop(); ui->btn_start->setEnabled(true); ui->btn_stop->setEnabled(false); ui->label_status->hide();