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

Creating zeroed backend types might crash #103

Closed
fkaa opened this issue Jun 23, 2018 · 1 comment
Closed

Creating zeroed backend types might crash #103

fkaa opened this issue Jun 23, 2018 · 1 comment

Comments

@fkaa
Copy link
Collaborator

fkaa commented Jun 23, 2018

In some places (eg. gfxBindBufferMemory) we create a zeroed type of the backend type and mem::replace it. If the backend type has a Drop impl rust will try to drop this zeroed type which might lead to bad things.

I'm not really sure what the intent of the mem::replace call is, does anyone know?

@kvark
Copy link
Member

kvark commented Jun 24, 2018

I think the reason for mem::replace is that we need to move the Unbound buffer out and then get the bound buffer to put back in. Without replace you can either de-reference or unbox, which is not useful here.

But overall, we should totally not drop random zeroed content ;)

bors bot added a commit that referenced this issue Jul 1, 2018
109: [WIP] Handle sanitation and gfx-hal update r=msiglreith,grovesNL a=kvark

Depends on gfx-rs/gfx#2195
Depends on gfx-rs/metal-rs#59
Fixes #103 

Co-authored-by: Dzmitry Malyshau <[email protected]>
bors bot added a commit that referenced this issue Jul 1, 2018
109: [WIP] Handle sanitation and gfx-hal update r=msiglreith,grovesNL a=kvark

Depends on gfx-rs/gfx#2195
Depends on gfx-rs/metal-rs#59
Fixes #103 

Co-authored-by: Dzmitry Malyshau <[email protected]>
@bors bors bot closed this as completed in #109 Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants