mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-30 18:14:18 +01:00
Fix surface drop order. (#6997)
* 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>
This commit is contained in:
1 parent
d06da58b66
commit
b2171dd1a4
2 files changed
+13
-6
No files matched your search
@@ -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
|
||||
|
||||
@@ -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<Box<dyn WindowHandle + 'window>>,
|
||||
|
||||
/// 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<Option<SurfaceConfiguration>>,
|
||||
|
||||
/// 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<Box<dyn WindowHandle + 'window>>,
|
||||
}
|
||||
|
||||
impl Surface<'_> {
|
||||
|
||||
Reference in new issue
Block a user