gtk: Clippy warns about unsound `Send` implementation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Nightly clippy raises the following warning:
```
warning: this implementation is unsound, as some fields in `WindowState` are `!Send`
--> druid-shell/src/backend/gtk/window.rs:1271:1
|
1271 | unsafe impl Send for WindowState {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(clippy::non_send_fields_in_send_ty)]` on by default
note: the type of field `window` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:173:5
|
173 | window: ApplicationWindow,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
note: the type of field `drawing_area` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:180:5
|
180 | drawing_area: DrawingArea,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
note: the type of field `surface` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:191:5
|
191 | surface: RefCell>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
note: the type of field `handler` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:196:5
|
196 | pub(crate) handler: RefCell>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
note: the type of field `deferred_queue` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:201:5
|
201 | deferred_queue: RefCell>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
note: the type of field `parent` is `!Send`
--> druid-shell/src/backend/gtk/window.rs:206:5
|
206 | parent: Option,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_send_fields_in_send_ty
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running nightly Clippy for the GTK backend and inspect the unsafe Send implementation at druid-shell/src/backend/gtk/window.rs:1271, along with the WindowState fields listed in the warning. Trace how WindowState is used across threads and determine a safe resolution. Done means the warning is addressed without introducing unsound cross-thread behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100