Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surfaces leak, never being destroyed #3646

Closed
BenjaminSchaaf opened this issue Apr 4, 2023 · 1 comment · Fixed by #3647
Closed

Surfaces leak, never being destroyed #3646

BenjaminSchaaf opened this issue Apr 4, 2023 · 1 comment · Fixed by #3647

Comments

@BenjaminSchaaf
Copy link
Contributor

Description
When making multiple surfaces the surfaces get leaked until program exit.

Incidentally this bug hides a different bug where destroying a surface leads to a vulkan validation error, as surfaces are not unconfigured before being destroyed.

Repro steps

  1. Add logging to wgpu-hal/src/vulkan/instance.rs#create_surface and wgpu-hal/src/vulkan/instance.rs#destroy_surface
  2. Create multiple windows, each with a surface
  3. Close one window, observe no surface being destroyed
  4. Close remaining windows, observe all surfaces being destroyed

Example project: https://gist.github.com/BenjaminSchaaf/46773ca8f1dc7217372c42d06922fd33

Expected vs observed behavior
Surfaces should be destroyed when the Surface is dropped, instead of leaking.

Platform
This happens on master with vulkan.

@BenjaminSchaaf
Copy link
Contributor Author

This is caused by this code being commented out:

//self.0.surface_drop(*surface)

BenjaminSchaaf pushed a commit to BenjaminSchaaf/wgpu that referenced this issue Apr 4, 2023
Surfaces weren't being dropped until exit due to the code commented out
in Context::surface_drop. This hid a bug where surfaces dropped before
exit weren't being unconfigured.

Fixes gfx-rs#3646
BenjaminSchaaf pushed a commit to BenjaminSchaaf/wgpu that referenced this issue Apr 4, 2023
Surfaces weren't being dropped until exit due to the code commented out
in Context::surface_drop. This hid a bug where surfaces dropped before
exit weren't being unconfigured.

Fixes gfx-rs#3646
BenjaminSchaaf pushed a commit to BenjaminSchaaf/wgpu that referenced this issue Apr 4, 2023
Surfaces weren't being dropped until exit due to the code commented out
in Context::surface_drop. This hid a bug where surfaces dropped before
exit weren't being unconfigured.

Fixes gfx-rs#3646
BenjaminSchaaf pushed a commit to BenjaminSchaaf/wgpu that referenced this issue Apr 4, 2023
Surfaces weren't being dropped until exit due to the code commented out
in Context::surface_drop. This hid a bug where surfaces dropped before
exit weren't being unconfigured.

Fixes gfx-rs#3646
BenjaminSchaaf pushed a commit to BenjaminSchaaf/wgpu that referenced this issue Apr 5, 2023
Surfaces weren't being dropped until exit due to the code commented out
in Context::surface_drop. This hid a bug where surfaces dropped before
exit weren't being unconfigured.

Fixes gfx-rs#3646
cwfitzgerald pushed a commit that referenced this issue Apr 5, 2023
Co-authored-by: Benjamin Schaaf <[email protected]>
Fixes #3646
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 a pull request may close this issue.

1 participant