Skip to content

Toggle Fullscreen segfaults in application example #4480

@TarekAS

Description

@TarekAS

Description

When running cargo run --example application and toggling fullscreen, the application segfaults with the following logs:

2026-02-08T12:20:33.503457Z  INFO application: User wake up
2026-02-08T12:20:33.579934Z  INFO application: Modifiers changed to ModifiersState(CONTROL)
2026-02-08T12:20:33.659226Z  INFO application: Executing action: ToggleFullscreen

thread 'main' (12295040) panicked at winit/examples/application.rs:975:21:
index out of bounds: the len is 1920000 but the index is 1920000
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2026-02-08T12:20:33.724373Z  INFO application: Application exited
2026-02-08T12:20:33.724518Z ERROR winit_common::event_handler: tried to run event handler, but no handler was set
2026-02-08T12:20:33.749846Z ERROR winit_common::event_handler: tried to run event handler, but no handler was set
[1]    68120 segmentation fault  cargo run --example application

Seems like the buffer size in draw() is being calculated before the resize, leading to index out-of-bounds issue.

Bug exists on macOS, but could also be on Windows and Linux. Don't have them to test.

macOS version

ProductName:            macOS
ProductVersion:         15.6.1
BuildVersion:           24G90

Winit version

0.31-beta2

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - appkitAffects the AppKit/macOS backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions