fix(bar): 修复 bar_cell_t text 字段可能为野指针 bug

This commit is contained in:
2026-06-09 10:28:35 +08:00
parent 8c145fb1b4
commit fa2f058032
3 changed files with 10 additions and 3 deletions

View File

@@ -33,6 +33,11 @@ static void bar_item_cleanup(zdwm_bar_item_t *item) {
if (destroy_state) destroy_state(item->state);
item->state = nullptr;
for (size_t i = 0; i < item->count; ++i) {
auto cell = &item->cells[i];
p_delete(&cell->text);
}
p_delete(&item->cells);
p_clear(item, 1);
}