Skip to content

Commit

Permalink
fix: 修复系统监视器中强制结束防杀进程失败后,弹出多次提示窗口的问题
Browse files Browse the repository at this point in the history
Description: 修复系统监视器中强制结束防杀进程失败后,弹出多次提示窗口的问题

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

Bug: https://pms.uniontech.com/bug-view-245061.html
  • Loading branch information
hundundadi authored and deepin-bot[bot] committed Mar 7, 2024
1 parent e578a24 commit efb68b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit efb68b1

Please sign in to comment.