From 93a242312f499b02a516fe4bfbbac3b3d0da7531 Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 6 Feb 2023 11:47:56 -0600 Subject: [PATCH] win32: Fix a couple of crashes. --- win32/CVulkan.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/win32/CVulkan.cpp b/win32/CVulkan.cpp index 37ada5b9..1c823d41 100644 --- a/win32/CVulkan.cpp +++ b/win32/CVulkan.cpp @@ -22,17 +22,19 @@ bool CVulkan::Initialize(HWND hWnd) swapchain = context->swapchain.get(); device = context->device; - if (GUI.shaderEnabled && GUI.OGLshaderFileName) + if (GUI.shaderEnabled && GUI.OGLshaderFileName && GUI.OGLshaderFileName[0]) { shaderchain = std::make_unique(context.get()); std::string shaderstring = _tToChar(GUI.OGLshaderFileName); if (!shaderchain->load_shader_preset(shaderstring)) { - return false; + shaderchain.reset(); + } + else + { + current_shadername = shaderstring; + return true; } - - current_shadername = shaderstring; - return true; } create_pipeline(); @@ -81,11 +83,10 @@ bool CVulkan::Initialize(HWND hWnd) void CVulkan::DeInitialize() { - if (!context) - return; - current_shadername = ""; - context->wait_idle(); + + if (context) + context->wait_idle(); shaderchain.reset(); textures.clear(); descriptors.clear();