From 660c157880ae1502b64ac862be9996ae305df01e Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 9 Apr 2018 19:16:47 +0200 Subject: [PATCH] Examples: Added missing calls for ::DestroyWindow, glfwDestroyWindow() + fix old comments. --- examples/directx10_example/main.cpp | 1 + examples/directx11_example/main.cpp | 1 + examples/directx12_example/main.cpp | 2 ++ examples/directx9_example/main.cpp | 1 + examples/opengl2_example/imgui_impl_glfw_gl2.cpp | 2 +- examples/opengl2_example/main.cpp | 2 ++ examples/opengl3_example/imgui_impl_glfw_gl3.cpp | 2 +- examples/opengl3_example/main.cpp | 2 ++ examples/vulkan_example/main.cpp | 2 ++ 9 files changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index f1afdf66a..b69919d07 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -208,6 +208,7 @@ int main(int, char**) ImGui::DestroyContext(); CleanupDeviceD3D(); + DestroyWindow(hwnd); UnregisterClass(_T("ImGui Example"), wc.hInstance); return 0; diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index d9ef40d1f..f91a181c0 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -211,6 +211,7 @@ int main(int, char**) ImGui::DestroyContext(); CleanupDeviceD3D(); + DestroyWindow(hwnd); UnregisterClass(_T("ImGui Example"), wc.hInstance); return 0; diff --git a/examples/directx12_example/main.cpp b/examples/directx12_example/main.cpp index 65fe70b59..24bf58cf2 100644 --- a/examples/directx12_example/main.cpp +++ b/examples/directx12_example/main.cpp @@ -410,7 +410,9 @@ int main(int, char**) WaitForLastSubmittedFrame(); ImGui_ImplDX12_Shutdown(); ImGui::DestroyContext(); + CleanupDeviceD3D(); + DestroyWindow(hwnd); UnregisterClass(_T("ImGui Example"), wc.hInstance); return 0; diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index fce9482e8..cb75a43f8 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -188,6 +188,7 @@ int main(int, char**) if (g_pd3dDevice) g_pd3dDevice->Release(); if (pD3D) pD3D->Release(); + DestroyWindow(hwnd); UnregisterClass(_T("ImGui Example"), wc.hInstance); return 0; diff --git a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp index 5e2e8fd45..2e12eddd3 100644 --- a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp +++ b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp @@ -20,7 +20,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag. -// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling). +// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()). // 2018-02-20: Inputs: Renamed GLFW callbacks exposed in .h to not include GL2 in their name. // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself. // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves. diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp index 8ee95cadc..92abfbd15 100644 --- a/examples/opengl2_example/main.cpp +++ b/examples/opengl2_example/main.cpp @@ -117,6 +117,8 @@ int main(int, char**) // Cleanup ImGui_ImplGlfwGL2_Shutdown(); ImGui::DestroyContext(); + + glfwDestroyWindow(window); glfwTerminate(); return 0; diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index 588939414..e5e852e31 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -16,7 +16,7 @@ // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag. // 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplGlfwGL3_Init() so user can override the GLSL version e.g. "#version 150". // 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context. -// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling). +// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()). // 2018-02-20: Inputs: Renamed GLFW callbacks exposed in .h to not include GL3 in their name. // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL3_RenderDrawData() in the .h file so you can call it yourself. // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves. diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index 06a9231a6..4ca766365 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -122,6 +122,8 @@ int main(int, char**) // Cleanup ImGui_ImplGlfwGL3_Shutdown(); ImGui::DestroyContext(); + + glfwDestroyWindow(window); glfwTerminate(); return 0; diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp index a708b6db9..cd0b0e49c 100644 --- a/examples/vulkan_example/main.cpp +++ b/examples/vulkan_example/main.cpp @@ -756,6 +756,8 @@ int main(int, char**) ImGui_ImplGlfwVulkan_Shutdown(); ImGui::DestroyContext(); cleanup_vulkan(); + + glfwDestroyWindow(window); glfwTerminate(); return 0;