fix invalid free

This commit is contained in:
Ádám Kovács
2025-05-29 11:04:43 +02:00
parent 53b93bad64
commit ba172cc8ed
3 changed files with 6 additions and 4 deletions

View File

@@ -45,7 +45,8 @@ pub const AppState = struct {
} else null;
if (index) |i| {
tab.childrenLoaded.observers.swapRemove(i);
const removed = tab.childrenLoaded.observers.swapRemove(i);
self.allocator.destroy(removed);
}
//TODO: remove from tabs

View File

@@ -12,7 +12,7 @@ pub fn Observable(T: type) type {
}
pub fn deinit(self: *Self) void {
for(self.observers)|o| {
for(self.observers.items)|o| {
self.allocator.destroy(o);
}
self.observers.deinit();