diff --git a/include/ui/mainwindow.h b/include/ui/mainwindow.h index 4db85c3..5686399 100644 --- a/include/ui/mainwindow.h +++ b/include/ui/mainwindow.h @@ -183,9 +183,9 @@ private: void refresh_proxy_list_impl(const int &id = -1, GroupSortAction groupSortAction = {}); - void refresh_proxy_list_impl_refresh_data(const int &id = -1); + void refresh_proxy_list_impl_refresh_data(const int &id = -1, bool stopping = false); - void refresh_table_item(int row, const std::shared_ptr& profile); + void refresh_table_item(int row, const std::shared_ptr& profile, bool stopping); void keyPressEvent(QKeyEvent *event) override; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index dedb337..0ff3486 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1045,7 +1045,7 @@ void MainWindow::refresh_proxy_list_impl(const int &id, GroupSortAction groupSor refresh_proxy_list_impl_refresh_data(id); } -void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id) { +void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id, bool stopping) { if (id >= 0) { auto rowID = ui->proxyListTable->id2Row[id]; @@ -1055,22 +1055,22 @@ void MainWindow::refresh_proxy_list_impl_refresh_data(const int &id) { return; } auto profile = NekoGui::profileManager->GetProfile(id); - refresh_table_item(rowID, profile); + refresh_table_item(rowID, profile, stopping); } else { for (int row = 0; row < ui->proxyListTable->rowCount(); row++) { auto profileId = ui->proxyListTable->row2Id[row]; auto profile = NekoGui::profileManager->GetProfile(profileId); - refresh_table_item(row, profile); + refresh_table_item(row, profile, stopping); } } } -void MainWindow::refresh_table_item(const int row, const std::shared_ptr& profile) +void MainWindow::refresh_table_item(const int row, const std::shared_ptr& profile, bool stopping) { if (profile == nullptr) return; - auto isRunning = profile->id == NekoGui::dataStore->started_id; + auto isRunning = profile->id == NekoGui::dataStore->started_id && !stopping; auto f0 = std::make_unique(); f0->setData(114514, profile->id); diff --git a/src/ui/mainwindow_grpc.cpp b/src/ui/mainwindow_grpc.cpp index efc0467..3b1070f 100644 --- a/src/ui/mainwindow_grpc.cpp +++ b/src/ui/mainwindow_grpc.cpp @@ -430,7 +430,7 @@ void MainWindow::neko_stop(bool crash, bool sem, bool manual) { runOnUiThread([=] { refresh_status(); - refresh_proxy_list(id); + refresh_proxy_list_impl_refresh_data(id, true); mu_stopping.unlock(); if (sem) sem_stopped.release();