Skip to content

Commit

Permalink
Merge pull request #299 from HellButcher/master
Browse files Browse the repository at this point in the history
call `Instance::destroy_surface`
  • Loading branch information
ezpuzz authored Jan 29, 2021
2 parents f15cf42 + d906ee2 commit 8e3054a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion factory/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,13 @@ where
self.instance.id(),
"Resource is not owned by specified instance"
);
drop(surface);
unsafe {
surface.dispose(
self.instance
.as_instance()
.expect("Cannot destroy surface without instance"),
);
}
}

/// Create target out of rendering surface.
Expand Down
10 changes: 10 additions & 0 deletions wsi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ where
usage,
})
}

/// Dispose of Surface.
///
/// # Safety
///
/// Surface must be not in use.
pub unsafe fn dispose(self, instance: &Instance<B>) {
self.assert_instance_owner(instance);
instance.destroy_surface(self.raw);
}
}

unsafe fn create_swapchain<B: Backend>(
Expand Down

0 comments on commit 8e3054a

Please sign in to comment.