Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复系统监视器中强制结束防杀进程失败后,弹出多次提示窗口的问题 #323

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion deepin-system-monitor-main/gui/process_table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ using namespace common::init;
const QByteArray header_version = "_1.0.0";
static const char *kSettingsOption_ProcessTableHeaderState = "process_table_header_state";
static const char *kSettingsOption_ProcessTableHeaderStateOfUserMode = "process_table_header_state_user";
/**
* @brief m_pControlConnection 单例对象的信号连接之后,需要保持只连接一次,避免多次触发信号槽
*/
static QMetaObject::Connection m_pControlConnection = QMetaObject::Connection();
ProcessTableView::ProcessTableView(DWidget *parent, QString userName)
: BaseTableView(parent)
, m_useModeName(userName)
Expand Down Expand Up @@ -878,11 +882,15 @@ void ProcessTableView::initConnections(bool settingsLoaded)
ErrorDialog::show(this, ec.getErrorName(), ec.getErrorMessage());
}
});
qInfo() << "'processControlResultReady' signal is connect?" << m_pControlConnection;
//The singleton object only needs to connect to the signal slot once.
//show error dialog if sending signals to process failed
connect(ProcessDB::instance(), &ProcessDB::processControlResultReady, this,
if(!m_pControlConnection)
m_pControlConnection = connect(ProcessDB::instance(), &ProcessDB::processControlResultReady, this,
[ = ](const ErrorContext & ec) {
if (ec) {
ErrorDialog::show(this, ec.getErrorName(), ec.getErrorMessage());
qWarning() << "ErrorName: " << ec.getErrorName() << ",ErrorMessage: " << ec.getErrorMessage();
}
});
}
Expand Down
1 change: 1 addition & 0 deletions deepin-system-monitor-main/process/process_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ void ProcessDB::sendSignalToProcess(pid_t pid, int signal)
errno,
QApplication::translate("Process.Signal", "Failed in sending signal to process"),
pid, SIGCONT, ec);
qWarning() << "Failed in sending signal to process! process id:" << pid;
Q_EMIT processControlResultReady(ec);
return;
}
Expand Down
Loading