Don't panic when destroying debug utils (#79)

* Don't panic when destroying debug utils

* Use zip instead of two branches

Co-authored-by: Jasper Bekkers <Jasper-Bekkers@users.noreply.github.com>
Co-authored-by: Jasper Bekkers <bekkers@gmail.com>
This commit is contained in:
Maik Klein 2020-10-21 21:07:18 +02:00 committed by GitHub
parent bba88ccfad
commit 7258a7c236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -631,13 +631,13 @@ impl Drop for ExampleBase {
.destroy_swapchain(self.swapchain, None);
self.device.destroy_device(None);
self.surface_loader.destroy_surface(self.surface, None);
// just let them leak for now
/*
self.debug_utils_loader
.take()
.unwrap()
.destroy_debug_utils_messenger(self.debug_call_back.take().unwrap(), None);
*/
if let Some((debug_utils, call_back)) =
Option::zip(self.debug_utils_loader.take(), self.debug_call_back.take())
{
debug_utils.destroy_debug_utils_messenger(call_back, None);
}
self.instance.destroy_instance(None);
}
}