Commit 8ba68ef
committed
fix: prevent dangling pointer in XembedProtocol::onRemoveItemByPid
1. Fixed a potential dangling pointer issue by storing
m_registedItem.keys() in a local variable
2. Previously used m_registedItem.keys() directly which could become
invalid after container modification
3. Now using a const copy of keys to ensure stable iteration during
item removal
4. This prevents crashes when removing items from the tray icon registry
Influence:
1. Test tray icon removal functionality when applications exit
2. Verify no crashes occur during dynamic tray icon updates
3. Test with multiple tray icons being added and removed simultaneously
4. Verify tray icon registry remains stable during container
modifications
fix: 修复 XembedProtocol::onRemoveItemByPid 中的野指针问题
1. 通过将 m_registedItem.keys() 存储在局部变量中修复了潜在的野指针问题
2. 之前直接使用 m_registedItem.keys(),在容器修改后可能变为无效
3. 现在使用 keys 的常量副本以确保在移除项目期间迭代的稳定性
4. 这防止了从托盘图标注册表中移除项目时发生崩溃
Influence:
1. 测试应用程序退出时的托盘图标移除功能
2. 验证在动态托盘图标更新期间不会发生崩溃
3. 测试多个托盘图标同时添加和移除的情况
4. 验证托盘图标注册表在容器修改期间保持稳定1 parent 50a5097 commit 8ba68ef
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
0 commit comments