rust-windowing / rust-windowing/winit

Last closed window still sends events after being dropped

Open
#3,926 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug DS - x11
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

Description

I have a program that manages windows using a HashMap<WindowId, Window>. After removing a window from the hashmap, and even manually calling drop() on it, it still continues to receive events (although the "destroyed" event is expected).

In the log below, I created two windows, closed one, clicked on my desktop, then closed the second window and clicked again. Each click resulted in two ModifiersChanged events for the last closed window, one for holding the click down and another for releasing it, despite the window being dropped:

received event RedrawRequested from nonexistent window WindowId(67108874)
received event Destroyed from inexistent window WindowId(67108874)
received event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) from inexistent window WindowId(67108874)
received event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) from inexistent window WindowId(67108874)
received event RedrawRequested from nonexistent window WindowId(67108867)
received event Destroyed from inexistent window WindowId(67108867)
received event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) from inexistent window WindowId(67108867)
received event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) from inexistent window WindowId(67108867)
OS and window mananger

Linux 6.6.51
Xwayland

Winit version

0.30.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a HashMap<WindowId, Window> on Linux 6.6.51 under Xwayland using winit 0.30.5, removing and dropping two windows before clicking the desktop. Trace the event handling for the dropped WindowId; done means the last closed window no longer receives ModifiersChanged events, while the expected Destroyed event may still appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.