diff --git a/CHANGELOG.md b/CHANGELOG.md index f688ff60c..0f61d7a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,11 @@ Bottom level categories: ## Unreleased +### v24.0.3 (2025-03-19) + +#### Bug Fixes +- Fix drop order in `Surface`, solving segfaults on exit on some systems. By @ed-2100 in [#6997](https://github.com/gfx-rs/wgpu/pull/6997) + ### v24.0.2 (2025-02-26) #### Bug Fixes diff --git a/wgpu/src/api/surface.rs b/wgpu/src/api/surface.rs index 37978dd43..66bcdbd9c 100644 --- a/wgpu/src/api/surface.rs +++ b/wgpu/src/api/surface.rs @@ -23,12 +23,6 @@ static_assertions::assert_impl_all!(SurfaceConfiguration: Send, Sync); /// [`GPUCanvasContext`](https://gpuweb.github.io/gpuweb/#canvas-context) /// serves a similar role. pub struct Surface<'window> { - /// Optionally, keep the source of the handle used for the surface alive. - /// - /// This is useful for platforms where the surface is created from a window and the surface - /// would become invalid when the window is dropped. - pub(crate) _handle_source: Option>, - /// Additional surface data returned by [`DynContext::instance_create_surface`]. pub(crate) inner: dispatch::DispatchSurface, @@ -39,6 +33,14 @@ pub struct Surface<'window> { // be wrapped in a mutex and since the configuration is only supplied after the surface has // been created is is additionally wrapped in an option. pub(crate) config: Mutex>, + + /// Optionally, keep the source of the handle used for the surface alive. + /// + /// This is useful for platforms where the surface is created from a window and the surface + /// would become invalid when the window is dropped. + /// + /// SAFETY: This field must be dropped *after* all other fields to ensure proper cleanup. + pub(crate) _handle_source: Option>, } impl Surface<'_> {