Merge pull request #1645 from lightpanda-io/fix-empty-struct

fix: add _pad to IdleDeadline to avoid identity_map pointer aliasing
This commit is contained in:
Karl Seguin
2026-02-25 08:58:58 +08:00
committed by GitHub
4 changed files with 12 additions and 0 deletions

View File

@@ -29,6 +29,9 @@ const Document = @import("Document.zig");
const DOMParser = @This(); const DOMParser = @This();
// Padding to avoid zero-size struct, which causes identity_map pointer collisions.
_pad: bool = false,
pub fn init() DOMParser { pub fn init() DOMParser {
return .{}; return .{};
} }

View File

@@ -20,6 +20,9 @@ const std = @import("std");
const IdleDeadline = @This(); const IdleDeadline = @This();
// Padding to avoid zero-size struct, which causes identity_map pointer collisions.
_pad: bool = false,
pub fn init() IdleDeadline { pub fn init() IdleDeadline {
return .{}; return .{};
} }

View File

@@ -22,6 +22,9 @@ const Element = @import("Element.zig");
pub const ResizeObserver = @This(); pub const ResizeObserver = @This();
// Padding to avoid zero-size struct, which causes identity_map pointer collisions.
_pad: bool = false,
fn init(cbk: js.Function) ResizeObserver { fn init(cbk: js.Function) ResizeObserver {
_ = cbk; _ = cbk;
return .{}; return .{};

View File

@@ -25,6 +25,9 @@ const dump = @import("../dump.zig");
const XMLSerializer = @This(); const XMLSerializer = @This();
// Padding to avoid zero-size struct, which causes identity_map pointer collisions.
_pad: bool = false,
pub fn init() XMLSerializer { pub fn init() XMLSerializer {
return .{}; return .{};
} }