Commit d332c8d
committed
fix: prevent crash when treeland restarts in taskbar
The crash occurs because when treeland restarts, the clear() method in
TreeLandWindowMonitor clears internal window lists but fails to reset
the tracked windows model. When treeland restart triggers a cleanup
followed by re-initialization, the model still holds stale references
to windows that have been destroyed, leading to a use-after-free crash
when the model attempts to access the window data during view updates.
Added clearTrackedWindows() method to properly clear all tracked windows
from the model using beginResetModel/endResetModel, and called it at
the start of clear() in both TreeLandWindowMonitor and X11WindowMonitor
to ensure the model is reset before internal lists are cleared. This
ensures the model and view are properly synchronized, preventing access
to destroyed window objects.
Log: fix treeland restart crash
Influence:
1. Test taskbar behavior when treeland restarts unexpectedly
2. Verify taskbar shows correct windows after treeland restart
3. Test taskbar with no windows open during treeland restart
4. Verify no crash when multiple rapid treeland restarts occur
5. Test X11 window monitor clear function for regressions
6. Verify taskbar preview windows still work correctly after restart
fix: 修复任务栏在treeland重启时崩溃的问题
当treeland重启时,TreeLandWindowMonitor中的clear()方法清除了内部窗口列
表,但未能重置跟踪窗口的模型。treeland重启触发清理后重新初始化时,模型
仍然持有已被销毁窗口的陈旧引用,导致视图更新时访问已释放的窗口对象引发崩
溃。新增clearTrackedWindows()方法,通过beginResetModel/endResetModel正确
清除模型中的所有跟踪窗口,并在TreeLandWindowMonitor和X11WindowMonitor的
clear()方法开始时调用该方法,确保在清除内部列表之前重置模型。这保证了模
型和视图同步一致,防止访问已销毁的窗口对象。
Log: 修复treeland重启崩溃问题
Influence:
1. 测试treeland异常重启时任务栏的行为
2. 验证treeland重启后任务栏显示正确的窗口
3. 测试treeland重启时没有打开任何窗口的情况
4. 验证多次快速重启treeland不会导致崩溃
5. 测试X11窗口监视器的清除功能是否有回归问题
6. 验证重启后任务栏预览窗口仍然正常工作1 parent e25ffed commit d332c8d
4 files changed
Lines changed: 11 additions & 0 deletions
File tree
- panels/dock/taskmanager
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
161 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
162 | 170 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
0 commit comments