From 89bc0feab097de2bc119fc686e7d610bcf57d636 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Fri, 4 Jun 2021 16:12:33 +0200
Subject: [PATCH] [#34] Fixed random crash during resizing!

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 src/vkcv/Core.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/vkcv/Core.cpp b/src/vkcv/Core.cpp
index fafdb560..292e71cd 100644
--- a/src/vkcv/Core.cpp
+++ b/src/vkcv/Core.cpp
@@ -113,6 +113,7 @@ namespace vkcv
 		);
 		
 		if (acquireResult != vk::Result::eSuccess) {
+			std::cerr << vk::to_string(acquireResult) << std::endl;
 			return Result::ERROR;
 		}
 		
@@ -130,12 +131,14 @@ namespace vkcv
 			m_swapchain.updateSwapchain(m_Context, m_window);
 			m_swapchainImageViews = createImageViews(m_Context, m_swapchain);
 		}
-    	
+		
     	if (acquireSwapchainImage() != Result::SUCCESS) {
-    		return;
+    		std::cerr << "Acquire failed!" << std::endl;
+    		
+    		m_currentSwapchainImageIndex = std::numeric_limits<uint32_t>::max();
     	}
-    	
-		m_Context.getDevice().waitIdle();	// TODO: this is a sin against graphics programming, but its getting late - Alex
+		
+		m_Context.getDevice().waitIdle(); // TODO: this is a sin against graphics programming, but its getting late - Alex
 	}
 
 	void Core::renderMesh(
@@ -267,7 +270,6 @@ namespace vkcv
         };
 
 		submitCommands(submitInfo, submitFunction, finishFunction);
-
 	}
 
 	void Core::endFrame() {
-- 
GitLab