From 4483320f0ab1e77fe0969c900bf7f6e30fc2c3fb Mon Sep 17 00:00:00 2001 From: DomRe <8564184+DomRe@users.noreply.github.com> Date: Fri, 4 Jan 2019 20:11:24 +0800 Subject: [PATCH] Examples: Allegro 5: Properly destroy all globals on shutdown. (#2262) --- docs/CHANGELOG.txt | 1 + examples/imgui_impl_allegro5.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index df5b685b..5af45c63 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -74,6 +74,7 @@ Other Changes: - Demo: Added a few more things under "Child windows" (changing ImGuiCol_ChildBg, positioning child, using IsItemHovered after a child). - Examples: DirectX10/11/12: Made imgui_impl_dx10/dx11/dx12.cpp link d3dcompiler.lib from the .cpp file to ease integration. +- Examples: Allegro 5: Properly destroy globals on shutdown to allow for restart. (#2262) [@DomRe] ----------------------------------------------------------------------- diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp index 004638e8..8d534516 100644 --- a/examples/imgui_impl_allegro5.cpp +++ b/examples/imgui_impl_allegro5.cpp @@ -280,9 +280,14 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) void ImGui_ImplAllegro5_Shutdown() { ImGui_ImplAllegro5_InvalidateDeviceObjects(); - g_Display = NULL; - // Destroy last known clipboard data + g_Display = NULL; + g_Time = 0.0; + + if (g_VertexDecl) + al_destroy_vertex_decl(g_VertexDecl); + g_VertexDecl = NULL; + if (g_ClipboardTextData) al_free(g_ClipboardTextData); g_ClipboardTextData = NULL;