mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Fix double-free of XHR on double client abort
It's possible (in fact normal) for client.abort to be called twice on a schedule navigation. We immediately abort any pending requests once a secondary navigation is called (is that right?), and then again when the page shuts down. The first abort will kill the transfer, so the XHR object has to null this value so that, on context shutdown, when the finalizer is called, we don't try to free it again.
This commit is contained in:
@@ -39,9 +39,10 @@ pub const FetchOpts = struct {
|
||||
writer: ?*std.Io.Writer = null,
|
||||
};
|
||||
pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
|
||||
var browser = try Browser.init(app, .{});
|
||||
const notification = try Notification.init(app.allocator);
|
||||
defer notification.deinit();
|
||||
|
||||
var browser = try Browser.init(app, .{});
|
||||
defer browser.deinit();
|
||||
|
||||
var session = try browser.newSession(notification);
|
||||
|
||||
Reference in New Issue
Block a user