From fa5998f89fd61d6cebca028e1c61655394c3e1e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Jul 2024 07:49:44 +0330 Subject: [PATCH] Fix: fix race in starting with systemProxy --- ui/mainwindow.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index c5e12f7..2a1a8b4 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -389,16 +389,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi }, DS_cores); - // Remember system proxy - if (NekoGui::dataStore->remember_enable || NekoGui::dataStore->flag_restart_tun_on) { - if (NekoGui::dataStore->remember_spmode.contains("system_proxy")) { - neko_set_spmode_system_proxy(true, false); - } - if (NekoGui::dataStore->remember_spmode.contains("vpn") || NekoGui::dataStore->flag_restart_tun_on) { - neko_set_spmode_vpn(true, false); - } - } - connect(qApp, &QGuiApplication::commitDataRequest, this, &MainWindow::on_commitDataRequest); auto t = new QTimer; @@ -563,6 +553,15 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info) } else if (info == "CoreCrashed") { neko_stop(true); } else if (info.startsWith("CoreStarted")) { + if (NekoGui::dataStore->remember_enable || NekoGui::dataStore->flag_restart_tun_on) { + if (NekoGui::dataStore->remember_spmode.contains("system_proxy")) { + neko_set_spmode_system_proxy(true, false); + } + if (NekoGui::dataStore->remember_spmode.contains("vpn") || NekoGui::dataStore->flag_restart_tun_on) { + neko_set_spmode_vpn(true, false); + } + } + neko_start(info.split(",")[1].toInt()); } }