Skip to content

fix(linux): silent crash on startup due to WindowSourceTooLarge #43

@SwarnenduG07

Description

@SwarnenduG07

Was trying to run the webview example on Arch Linux (Niri compositor) and it was crashing immediately on startup with just error: CallbackFailed and no other info.

Took a while to track down because the error was being swallowed. Added logging to RunState.emit and found the actual error: WindowSourceTooLarge.

The webview example's inline HTML is 4230 bytes but max_window_source_bytes is hardcoded to 4096 in src/platform/root.zig. So it fails on app_start and shuts down before the window even appears.

Fixes:

  1. Bump max_window_source_bytes to 8192 in src/platform/root.zig
  2. Log the actual error in RunState.emit instead of silently setting failed = true
  3. Use G_APPLICATION_NON_UNIQUE in gtk_host.c — G_APPLICATION_DEFAULT_FLAGS tries to register on D-Bus which may not be available on all Wayland setups

Note for Arch users: Zig 0.16.0 can't link against GCC 16's crt1.o due to .sframe relocations. Workaround:
bash
sudo objcopy --remove-section=.sframe /usr/lib/crt1.o /usr/lib/crt1.o

That's a Zig issue not a zero-native one.

Environment: Arch Linux, Niri, GCC 16.1.1, Zig 0.16.0, WebKitGTK 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions