diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 18f45a5..733949c 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -803,21 +803,22 @@ bool MainWindow::get_elevated_permissions(int reason) { } auto n = QMessageBox::warning(GetMessageBoxParent(), software_name, tr("Please give the core root privileges"), QMessageBox::Yes | QMessageBox::No); if (n == QMessageBox::Yes) { - auto chownArgs = QString("root:root " + NekoGui::FindNekoBoxCoreRealPath()); - auto ret = Linux_Run_Command("chown", chownArgs); - if (ret != 0) { - MW_show_log(QString("Failed to run chown %1 code is %2").arg(chownArgs).arg(ret)); - return false; - } - auto chmodArgs = QString("u+s " + NekoGui::FindNekoBoxCoreRealPath()); - ret = Linux_Run_Command("chmod", chmodArgs); - if (ret == 0) { - StopVPNProcess(); - return true; - } else { - MW_show_log(QString("Failed to run chmod %1").arg(chmodArgs)); - return false; - } + runOnNewThread([=] + { + auto chownArgs = QString("root:root " + NekoGui::FindNekoBoxCoreRealPath()); + auto ret = Linux_Run_Command("chown", chownArgs); + if (ret != 0) { + MW_show_log(QString("Failed to run chown %1 code is %2").arg(chownArgs).arg(ret)); + } + auto chmodArgs = QString("u+s " + NekoGui::FindNekoBoxCoreRealPath()); + ret = Linux_Run_Command("chmod", chmodArgs); + if (ret == 0) { + StopVPNProcess(); + } else { + MW_show_log(QString("Failed to run chmod %1").arg(chmodArgs)); + } + }); + return false; } #endif #ifdef Q_OS_WIN