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