660: Fix possible out-of-bounds when trace log level enabled r=kvark a=yanchith

Also, even when there was no out-of-bounds access, the log statement talked
about an incorrect submission index.

Fixes https://github.com/gfx-rs/wgpu/issues/659

Co-authored-by: yanchith <yanchi.toth@gmail.com>
This commit is contained in:
bors[bot] 2020-05-18 16:02:36 +00:00 committed by GitHub
commit a203333c3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,10 +27,10 @@ impl<B: hal::Backend> CommandPool<B> {
fn maintain(&mut self, lowest_active_index: SubmissionIndex) {
for i in (0..self.pending.len()).rev() {
if self.pending[i].1 < lowest_active_index {
let cmd_buf = self.pending.swap_remove(i).0;
let (cmd_buf, index) = self.pending.swap_remove(i);
log::trace!(
"recycling comb submitted in {} when {} is lowest active",
self.pending[i].1,
index,
lowest_active_index,
);
self.recycle(cmd_buf);