mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
fix only one hook working per event (I forgot to zero the memory)
This commit is contained in:
parent
2da4e1e938
commit
7a619ab770
1 changed files with 1 additions and 7 deletions
|
|
@ -25,10 +25,8 @@ pub fn put(self: *Events, key: []const u8, hook: *const Hook) !void {
|
||||||
ll = sll;
|
ll = sll;
|
||||||
} else {
|
} else {
|
||||||
ll = try self.allocator.create(std.SinglyLinkedList);
|
ll = try self.allocator.create(std.SinglyLinkedList);
|
||||||
|
ll.* = .{};
|
||||||
try self.events.put(key, ll);
|
try self.events.put(key, ll);
|
||||||
if (self.events.get(key)) |sll| {
|
|
||||||
ll = sll;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const data = try self.allocator.create(Node);
|
const data = try self.allocator.create(Node);
|
||||||
data.* = .{
|
data.* = .{
|
||||||
|
|
@ -47,10 +45,6 @@ pub fn exec(self: *Events, event: []const u8, args: anytype) void {
|
||||||
while (node) |n| : (node = n.next) {
|
while (node) |n| : (node = n.next) {
|
||||||
const data: *Node = @fieldParentPtr("node", n);
|
const data: *Node = @fieldParentPtr("node", n);
|
||||||
data.hook.callback(args);
|
data.hook.callback(args);
|
||||||
|
|
||||||
// FIXME: not sure why but for some reason our ll doesn't seem to want to
|
|
||||||
// admit that there's nothing after the first node.
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue