Commit 97d5fcf
committed
fix: prevent crash when closing wayland popup surfaces
- Problem: dde-tray-loader crashes with SEGFAULT in QWaylandWindow::decoration() during popup closing.
- Reason: Reentrancy in QWaylandShmBackingStore::beginPaint(). It dispatches Wayland events synchronously, which can trigger plugin_popup_close() in the middle of a paint operation. Synchronously closing the window destroys the platform handle, causing beginPaint to crash when it resumes.
- Solution 1: Use QMetaObject::invokeMethod with Qt::QueuedConnection in plugin_popup_close() to defer window destruction until the current paint operation completes.
- Solution 2: Implement a global NullHandleGuard event filter to intercept and drop any UpdateRequest events directed at widgets or windows whose Wayland handles have been invalidated.
- 问题: 弹窗关闭时 dde-tray-loader 崩溃,堆栈指向 QWaylandWindow::decoration()。
- 原因: QWaylandShmBackingStore::beginPaint() 在绘制过程中同步分发 Wayland 事件,导致 plugin_popup_close() 被重入调用。同步关闭窗口会销毁底层 handle,导致 beginPaint 恢复执行时访问空指针崩溃。
- 解决 1: 在 plugin_popup_close() 中使用 QMetaObject::invokeMethod 配合队列连接,将窗口销毁操作推迟到当前绘制周期结束之后。
- 解决 2: 实现全局事件过滤器 NullHandleGuard,拦截并丢弃所有指向已销毁 Wayland 表面或无效窗口的 UpdateRequest 请求,防止僵尸绘制事件触发崩溃。
Log: prevent crash when closing wayland popup surfaces
Pms: BUG-358679
Change-Id: I2610d04675ee628080eab2c52171f39d9d752c911 parent 3de8e50 commit 97d5fcf
1 file changed
Lines changed: 83 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
15 | 65 | | |
16 | 66 | | |
17 | 67 | | |
| |||
132 | 182 | | |
133 | 183 | | |
134 | 184 | | |
135 | | - | |
136 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
137 | 217 | | |
138 | 218 | | |
139 | 219 | | |
| |||
0 commit comments