Skip to content

fix: fix Layer Shell popup positioning race condition#1025

Draft
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/layer-shell-popup-race-condition
Draft

fix: fix Layer Shell popup positioning race condition#1025
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/layer-shell-popup-race-condition

Conversation

@deepin-wm

Copy link
Copy Markdown
Contributor

问题描述

UOS ID 登录窗口概率性显示异常,不可点击。根本原因是 Layer Shell 弹窗定位时存在时序竞态:当弹窗创建时,其父 Layer Surface 的几何信息可能尚未完成初始化,导致弹窗定位到错误位置。

修改内容

  1. handleLayerShellPopup() — 增加父窗口几何有效性检查(hasInitializeContainer 和 parentGeo.isEmpty()),未通过则跳过定位等待重新触发
  2. arrangePopupSurface() — 对 Layer 类型父窗口增加 hasInitializeContainer() 检查
  3. addSurface() — 连接父 Layer Surface 的 normalGeometryChanged 和 hasInitializeContainerChanged 信号触发弹窗重新定位,使用 QPointer 保证安全,使用 QMetaObject::Connection + m_parentLayerConnections 哈希表管理连接生命周期
  4. removeSurface() — popup 移除时精确断开父表面到 Output 的信号连接
  5. 添加 #include 显式声明,恢复 input popup teardown 边界注释

修改文件

  • src/output/output.cpp
  • src/output/output.h

测试建议

  1. 测试 UOS ID 登录窗口每次打开均正常显示
  2. 测试父表面调整大小后 Layer Shell 弹窗定位正确
  3. 测试父表面销毁时弹窗正确清理
  4. 测试其他 Layer Shell 弹窗(菜单、工具提示)正常工作

1. Add parent geometry validity check in handleLayerShellPopup()
   with hasInitializeContainer and parentGeo.isEmpty() guards
2. Add hasInitializeContainer() check for Layer type parent in
   arrangePopupSurface()
3. Connect parent Layer Surface signals (normalGeometryChanged,
   hasInitializeContainerChanged) in addSurface() to trigger popup
   repositioning using QPointer for safety
4. Use QMetaObject::Connection with m_parentLayerConnections hash
   to manage signal connection lifecycle
5. Disconnect parent surface signals in removeSurface() for proper
   cleanup when popup is removed
6. Add #include <QPointer> explicit declaration

Log: Fixed UOS ID login window intermittently displaying abnormally and becoming unclickable

Influence:
1. Test UOS ID login window opens and displays correctly every time
2. Test Layer Shell popup positioning after parent surface resize
3. Test popup cleanup when parent surface is destroyed
4. Test other Layer Shell popups (menus, tooltips) still work

fix: 修复Layer Shell弹窗定位时序竞态问题

1. 在handleLayerShellPopup()中增加父窗口几何有效性检查,
   使用hasInitializeContainer和parentGeo.isEmpty()守卫
2. 在arrangePopupSurface()中对Layer类型父窗口增加
   hasInitializeContainer()检查
3. 在addSurface()中连接父Layer Surface信号
   (normalGeometryChanged, hasInitializeContainerChanged)
   触发弹窗重新定位,使用QPointer保证安全
4. 使用QMetaObject::Connection配合m_parentLayerConnections
   哈希表管理信号连接生命周期
5. 在removeSurface()中断开父表面信号连接,确保弹窗移除时
   正确清理
6. 添加#include <QPointer>显式声明

Log: 修复UOS ID登录窗口概率性显示异常不可点击的问题

Influence:
1. 测试UOS ID登录窗口每次打开均正常显示
2. 测试父表面调整大小后Layer Shell弹窗定位正确
3. 测试父表面销毁时弹窗正确清理
4. 测试其他Layer Shell弹窗(菜单、工具提示)正常工作

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @deepin-wm, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants