netsurf: declare EventTargetTBase as extern

to guarantee the memory layout
This commit is contained in:
Pierre Tachoire
2024-02-15 16:00:48 +01:00
parent 069313817a
commit 35ede4d79c
2 changed files with 2 additions and 2 deletions

View File

@@ -333,7 +333,7 @@ pub const Page = struct {
// dispatch window.load event // dispatch window.load event
const loadevt = try parser.eventCreate(); const loadevt = try parser.eventCreate();
try parser.eventInit(loadevt, "load", .{}); try parser.eventInit(loadevt, "load", .{});
_ = try parser.eventTargetDispatchEvent(parser.toEventTarget(EventTargetTBase, &self.session.window), loadevt); _ = try parser.eventTargetDispatchEvent(parser.toEventTarget(Window, &self.session.window), loadevt);
} }
// evalScript evaluates the src in priority. // evalScript evaluates the src in priority.

View File

@@ -653,7 +653,7 @@ pub fn eventTargetTBaseFieldName(comptime T: type) ?[]const u8 {
} }
// EventTargetBase is used to implement EventTarget for pure zig struct. // EventTargetBase is used to implement EventTarget for pure zig struct.
pub const EventTargetTBase = struct { pub const EventTargetTBase = extern struct {
const Self = @This(); const Self = @This();
vtable: ?*const c.struct_dom_event_target_vtable = &c.struct_dom_event_target_vtable{ vtable: ?*const c.struct_dom_event_target_vtable = &c.struct_dom_event_target_vtable{