block: only free the descriptor once
This commit is contained in:
parent
b8d5546db2
commit
62bcb951b8
1 changed files with 5 additions and 3 deletions
|
@ -107,11 +107,13 @@ pub fn Block(
|
|||
fn descDisposeHelper(src: *anyopaque) callconv(.C) void {
|
||||
const real_src: *Context = @ptrCast(@alignCast(src));
|
||||
inline for (captures_info.fields) |field| {
|
||||
if (field.type == objc.c.id) _Block_object_dispose(@field(real_src, field.name), 3);
|
||||
alloc.free(std.mem.sliceTo(@field(@field(real_src, "descriptor"), "signature").?, 0));
|
||||
alloc.destroy(@field(real_src, "descriptor"));
|
||||
if (field.type == objc.c.id) {
|
||||
_Block_object_dispose(@field(real_src, field.name), 3);
|
||||
}
|
||||
}
|
||||
alloc.free(std.mem.sliceTo(real_src.descriptor.signature.?, 0));
|
||||
alloc.destroy(real_src.descriptor);
|
||||
}
|
||||
|
||||
/// Creates a function type for the invocation function, but alters
|
||||
/// the first arg. The first arg is a pointer so from an ABI perspective
|
||||
|
|
Loading…
Add table
Reference in a new issue