File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11const std = @import ("std" );
22const Allocator = std .mem .Allocator ;
33
4+ const Env = @import ("browser/env.zig" ).Env ;
45const Loop = @import ("runtime/loop.zig" ).Loop ;
56const HttpClient = @import ("http/client.zig" ).Client ;
67const Telemetry = @import ("telemetry/telemetry.zig" ).Telemetry ;
@@ -11,6 +12,7 @@ const log = std.log.scoped(.app);
1112// Container for global state / objects that various parts of the system
1213// might need.
1314pub const App = struct {
15+ env : * Env ,
1416 loop : * Loop ,
1517 config : Config ,
1618 allocator : Allocator ,
@@ -47,7 +49,11 @@ pub const App = struct {
4749
4850 const app_dir_path = getAndMakeAppDir (allocator );
4951
52+ const env = try Env .init (allocator , .{});
53+ errdefer env .deinit ();
54+
5055 app .* = .{
56+ .env = env ,
5157 .loop = loop ,
5258 .allocator = allocator ,
5359 .telemetry = undefined ,
@@ -75,6 +81,7 @@ pub const App = struct {
7581 allocator .destroy (self .loop );
7682 self .http_client .deinit ();
7783 self .notification .deinit ();
84+ self .env .deinit ();
7885 allocator .destroy (self );
7986 }
8087};
Original file line number Diff line number Diff line change @@ -45,15 +45,13 @@ pub const Browser = struct {
4545 pub fn init (app : * App ) ! Browser {
4646 const allocator = app .allocator ;
4747
48- const env = try Env .init (allocator , .{});
49- errdefer env .deinit ();
5048
5149 const notification = try Notification .init (allocator , app .notification );
5250 errdefer notification .deinit ();
5351
5452 return .{
5553 .app = app ,
56- .env = env ,
54+ .env = app . env ,
5755 .session = null ,
5856 .allocator = allocator ,
5957 .notification = notification ,
@@ -66,7 +64,6 @@ pub const Browser = struct {
6664
6765 pub fn deinit (self : * Browser ) void {
6866 self .closeSession ();
69- self .env .deinit ();
7067 self .page_arena .deinit ();
7168 self .session_arena .deinit ();
7269 self .transfer_arena .deinit ();
You can’t perform that action at this time.
0 commit comments