mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-14 05:46:17 +00:00
flatpak: detach process tracking thread after spawn
This makes sure the underlying thread implementation know to free resources the moment the thread is no longer necessary, preventing leaks from not manually collecting the thread.
This commit is contained in:
@@ -112,6 +112,8 @@ pub const FlatpakHostCommand = struct {
|
|||||||
pub fn spawn(self: *FlatpakHostCommand, alloc: Allocator) !u32 {
|
pub fn spawn(self: *FlatpakHostCommand, alloc: Allocator) !u32 {
|
||||||
const thread = try std.Thread.spawn(.{}, threadMain, .{ self, alloc });
|
const thread = try std.Thread.spawn(.{}, threadMain, .{ self, alloc });
|
||||||
thread.setName("flatpak-host-command") catch {};
|
thread.setName("flatpak-host-command") catch {};
|
||||||
|
// We don't track this thread, it will terminate on its own on command exit
|
||||||
|
thread.detach();
|
||||||
|
|
||||||
// Wait for the process to start or error.
|
// Wait for the process to start or error.
|
||||||
self.state_mutex.lock();
|
self.state_mutex.lock();
|
||||||
|
Reference in New Issue
Block a user