Skip to content

Fix surface drop order.#6997

Merged
cwfitzgerald merged 3 commits intogfx-rs:trunkfrom
ed-2100:fix_surface_drop_order
Jan 27, 2025
Merged

Fix surface drop order.#6997
cwfitzgerald merged 3 commits intogfx-rs:trunkfrom
ed-2100:fix_surface_drop_order

Conversation

@ed-2100
Copy link
Copy Markdown
Contributor

@ed-2100 ed-2100 commented Jan 26, 2025

Connections
Fixes #4650

Description
If Surface is constructed with an Arc<Window> reference and no other strong references are present when the Surface is deconstructed, wayland will segfault.
This is because the drop order of Surface specifies that _handle_source be dropped before inner.
This is fixed by reordering the struct such that _handle_source is dropped last.

Testing
Explain how this change is tested.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@ed-2100 ed-2100 marked this pull request as ready for review January 26, 2025 23:04
@ed-2100 ed-2100 requested a review from a team as a code owner January 26, 2025 23:04
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
@ed-2100 ed-2100 requested a review from cwfitzgerald January 27, 2025 03:08
Copy link
Copy Markdown
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this as this seems more correct, and if there are any issues in practice revisit if needed.

@cwfitzgerald cwfitzgerald merged commit 36ccc9f into gfx-rs:trunk Jan 27, 2025
@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Jan 30, 2025
@ed-2100 ed-2100 deleted the fix_surface_drop_order branch February 17, 2025 14:50
@ed-2100 ed-2100 restored the fix_surface_drop_order branch February 17, 2025 14:50
@ed-2100 ed-2100 deleted the fix_surface_drop_order branch February 17, 2025 14:52
davnotdev pushed a commit to davnotdev/wgpu that referenced this pull request Mar 4, 2025
* Fix surface drop order.

* Add changes to changelog.

* Update SAFETY note.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
@radgeRayden
Copy link
Copy Markdown
Contributor

I take it this did not make its way into 24.0.2? I'm still getting segfaults, wanted to make sure the fix just didn't land.

@cwfitzgerald
Copy link
Copy Markdown
Member

Yeah, it's not been backported yet - I think this is worth backporting still, I'll see if I can do this today.

cwfitzgerald added a commit that referenced this pull request Mar 19, 2025
* Fix surface drop order.

* Add changes to changelog.

* Update SAFETY note.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wayland] crash in eglTerminate on program exit

3 participants