---
src/api/shellpipe_async.zig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/api/shellpipe_async.zig b/src/api/shellpipe_async.zig
index 63c919a0caeb..a7487fa37b27 100644
--- a/src/api/shellpipe_async.zig
+++ b/src/api/shellpipe_async.zig
@@ -34,11 +34,12 @@ fn async_shellpipe(mepo: *Mepo, unique_handle_id: i8, cmd: []const u8) !void {
sp_req.unique_handle_id = unique_handle_id;
sp_req.cmd = try mepo.allocator.dupeZ(u8, cmd);
sp_req.mepo = mepo;
- _ = sdl.SDL_CreateThread(async_shellpipe_run, "async_shellpipe", sp_req);
+ sdl.SDL_DetachThread(sdl.SDL_CreateThread(async_shellpipe_run, "async_shellpipe", sp_req));
}
fn async_shellpipe_run(userdata: ?*anyopaque) callconv(.C) c_int {
const shellpipe_request: *AsyncShellpipeRequest = @alignCast(@ptrCast(userdata.?));
+ defer shellpipe_request.mepo.allocator.destroy(shellpipe_request);
async_shellpipe_run_catch_errors(shellpipe_request.mepo, shellpipe_request.unique_handle_id, shellpipe_request.cmd) catch |err| {
utildbg.log("Error running async shellpipe: {}\n", .{err});
};
--
2.41.0
On Tue, Jun 4, 2024, at 11:02 PM, Nguyễn Gia Phong wrote:
> ---
> src/api/shellpipe_async.zig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/api/shellpipe_async.zig b/src/api/shellpipe_async.zig
> index 63c919a0caeb..a7487fa37b27 100644
> --- a/src/api/shellpipe_async.zig
> +++ b/src/api/shellpipe_async.zig
> @@ -34,11 +34,12 @@ fn async_shellpipe(mepo: *Mepo, unique_handle_id:
> i8, cmd: []const u8) !void {
> sp_req.unique_handle_id = unique_handle_id;
> sp_req.cmd = try mepo.allocator.dupeZ(u8, cmd);
> sp_req.mepo = mepo;
> - _ = sdl.SDL_CreateThread(async_shellpipe_run, "async_shellpipe",
> sp_req);
> + sdl.SDL_DetachThread(sdl.SDL_CreateThread(async_shellpipe_run,
> "async_shellpipe", sp_req));
> }
>
> fn async_shellpipe_run(userdata: ?*anyopaque) callconv(.C) c_int {
> const shellpipe_request: *AsyncShellpipeRequest =
> @alignCast(@ptrCast(userdata.?));
> + defer shellpipe_request.mepo.allocator.destroy(shellpipe_request);
> async_shellpipe_run_catch_errors(shellpipe_request.mepo,
> shellpipe_request.unique_handle_id, shellpipe_request.cmd) catch |err| {
> utildbg.log("Error running async shellpipe: {}\n", .{err});
> };
> --
> 2.41.0
Very nice catch. Thanks for sending - applied!