feat: add pid and AM-based appid query fallback for wayland session#1652
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideExtends TreeLandWindow identity information to include both the Wayland foreign toplevel appid and the window’s process ID, enabling PID- and app-id–based fallback identification for Wayland sessions. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Callers of
identity()previously received a single-element list containing only the appid; adding the PID as a second element changes that contract, so please verify and adapt all call sites to handle the new structure rather than assuming index 0 is the sole identity. - Consider omitting the PID or appid when they are invalid (e.g., empty appid or
pid()returning 0/negative) instead of always pushing two entries, to avoid propagating meaningless identifiers into consumers ofidentity().
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Callers of `identity()` previously received a single-element list containing only the appid; adding the PID as a second element changes that contract, so please verify and adapt all call sites to handle the new structure rather than assuming index 0 is the sole identity.
- Consider omitting the PID or appid when they are invalid (e.g., empty appid or `pid()` returning 0/negative) instead of always pushing two entries, to avoid propagating meaningless identifiers into consumers of `identity()`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
为 treeland 会话增加基于 pid 反查归属应用 appid 信息的逻辑. PMS: BUG-360357 Log:
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, tsic404 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/panels/dock/taskmanager/treelandwindow.cpp b/panels/dock/taskmanager/treelandwindow.cpp
index c9dd3701a..54b338596 100644
--- a/panels/dock/taskmanager/treelandwindow.cpp
+++ b/panels/dock/taskmanager/treelandwindow.cpp
@@ -144,7 +144,14 @@ pid_t TreeLandWindow::pid()
QStringList TreeLandWindow::identity()
{
- return QStringList{
- (m_foreignToplevelHandle ? m_foreignToplevelHandle->appid() : ""),
- QString::number(pid())
- };
+ QString appId = m_foreignToplevelHandle ? m_foreignToplevelHandle->appid() : "";
+ qint64 currentPid = pid();
+
+ // 防御性检查:确保获取到的 pid 合法有效,避免无效进程 ID 污染窗口标识列表
+ if (currentPid <= 0) {
+ return QStringList{appId};
+ }
+
+ return QStringList{
+ appId,
+ QString::number(currentPid)
+ };
} |
为 treeland 会话增加基于 pid 反查归属应用 appid 信息的逻辑.
PMS: BUG-360357
Summary by Sourcery
Enhancements: