KyleMayes / vulkanalia

Vulkan bindings for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The push_next builders method work only once

Staco78 opened this issue · comments

Only the last extension struct will be submitted when using several times push_next because the struct next pointer isn't properly updated.

The methods look like:

let next = (next.as_mut() as *mut T).cast::<InstanceCreateInfo>();
unsafe { *next }.next = self.next;
next = next.cast();
self

The line unsafe { *next }.next = self.next; create a local copy of next (because of the {}) then edit the next field of this local copy but not of the real one.
Replacing it with unsafe { &mut *next }.next = self.next; or unsafe { (*next).next = self.next }; works.

Thanks for the bug report, this has been fixed in v0.19.0.

@KyleMayes has this perhaps resurfaced in #188 ?