mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
fix memory leak
This commit is contained in:
@@ -178,7 +178,7 @@ pub const Session = struct {
|
|||||||
|
|
||||||
fn deinit(self: *Session) void {
|
fn deinit(self: *Session) void {
|
||||||
if (self.page) |*p| {
|
if (self.page) |*p| {
|
||||||
p.end();
|
p.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.env.deinit();
|
self.env.deinit();
|
||||||
@@ -214,6 +214,10 @@ pub const Session = struct {
|
|||||||
self.page = Page.init(self.allocator, self);
|
self.page = Page.init(self.allocator, self);
|
||||||
return &self.page.?;
|
return &self.page.?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn currentPage(self: *Session) ?*Page {
|
||||||
|
return &(self.page orelse return null);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Page navigates to an url.
|
// Page navigates to an url.
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ fn navigate(cmd: anytype) !void {
|
|||||||
|
|
||||||
// Launch navigate, the page must have been created by a
|
// Launch navigate, the page must have been created by a
|
||||||
// target.createTarget.
|
// target.createTarget.
|
||||||
var p = cmd.session.page orelse return error.NoPage;
|
var p = cmd.session.currentPage() orelse return error.NoPage;
|
||||||
state.execution_context_id += 1;
|
state.execution_context_id += 1;
|
||||||
|
|
||||||
const aux_data = try std.fmt.allocPrint(
|
const aux_data = try std.fmt.allocPrint(
|
||||||
|
|||||||
Reference in New Issue
Block a user