layers: Fix IMAGE_STATE::Unlink() for swapchain images
Since these images are only destroyed when the swapchain is
destroyed, calling RemoveParent on it is unnecessary and can
cause the parent_nodes_ set to be corrupted.
diff --git a/layers/image_state.cpp b/layers/image_state.cpp
index ca525bb..5cb7311 100644
--- a/layers/image_state.cpp
+++ b/layers/image_state.cpp
@@ -545,9 +545,9 @@
void SWAPCHAIN_NODE::Destroy() {
for (auto &swapchain_image : images) {
if (swapchain_image.image_state) {
+ RemoveParent(swapchain_image.image_state);
swapchain_image.image_state->Destroy();
dev_data->imageMap.erase(swapchain_image.image_state->image());
- swapchain_image.image_state = nullptr;
}
// NOTE: We don't have access to dev_data->fake_memory.Free() here, but it is currently a no-op
}