From a8a47b138f8d5febedd65b65003f4bae42162300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Mon, 2 Mar 2026 11:50:56 +0900 Subject: [PATCH] mcp: change browser from pointer to value --- src/mcp/Server.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mcp/Server.zig b/src/mcp/Server.zig index 48cf5f2e..cb2cd9c4 100644 --- a/src/mcp/Server.zig +++ b/src/mcp/Server.zig @@ -12,7 +12,7 @@ app: *App, http_client: *HttpClient, notification: *lp.Notification, -browser: *lp.Browser, +browser: lp.Browser, session: *lp.Session, page: *lp.Page, @@ -31,9 +31,7 @@ pub fn init(allocator: std.mem.Allocator, app: *App) !*Self { self.notification = try .init(allocator); errdefer self.notification.deinit(); - self.browser = try allocator.create(lp.Browser); - errdefer allocator.destroy(self.browser); - self.browser.* = try .init(app, .{ .http_client = self.http_client }); + self.browser = try lp.Browser.init(app, .{ .http_client = self.http_client }); errdefer self.browser.deinit(); self.session = try self.browser.newSession(self.notification); @@ -46,7 +44,6 @@ pub fn deinit(self: *Self) void { self.is_running.store(false, .release); self.browser.deinit(); - self.allocator.destroy(self.browser); self.notification.deinit(); self.http_client.deinit();