Commit 96c0307
committed
fix: prevent crash from invalid indexes in window monitoring
Add validity checks for model indexes and window pointers to prevent
crashes when accessing data from window monitoring models. The crash
occurred in treeland environment due to accessing invalid indexes
or null window pointers, particularly in the `data()` methods of
`AbstractWindowMonitor` and `RoleCombineModel`, and when matching
windows in `TaskManager::handleWindowAdded`.
Log: Fixed a crash in the dock's window monitoring system by adding null
and index validity checks
Influence:
1. Test dock stability under treeland by switching between multiple
windows rapidly
2. Verify dock does not crash when adding/removing windows dynamically
3. Test with invalid model states (empty models, invalid indexes)
4. Verify window matching still works correctly for active apps
5. Test combination models with various role mappings
fix: 修复窗口监控中无效索引导致的崩溃问题
在窗口监控模型中增加模型索引和窗口指针的有效性检查,防止因访问
无效索引或空窗口指针导致崩溃。该崩溃在 treeland 环境下偶发,主要
由 `AbstractWindowMonitor` 和 `RoleCombineModel` 的数据访问方法以及
`TaskManager::handleWindowAdded` 中的窗口匹配逻辑引起。
Log: 修复了 dock 窗口监控系统中因缺少空指针和索引有效性检查导致的崩溃
问题
Influence:
1. 在 treeland 环境下快速切换多个窗口测试 dock 稳定性
2. 验证动态添加/删除窗口时 dock 不会崩溃
3. 测试空模型和无效索引等异常状态
4. 验证活跃应用的窗口匹配功能正常
5. 测试多种角色映射的组合模型1 parent 9d8b608 commit 96c0307
3 files changed
Lines changed: 24 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | | - | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
345 | 349 | | |
346 | 350 | | |
347 | 351 | | |
| |||
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
358 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
359 | 368 | | |
360 | 369 | | |
361 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
332 | 335 | | |
333 | 336 | | |
334 | 337 | | |
| |||
0 commit comments