mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Backends: Added more implicit asserts to detect invalid/redundant calls to Shutdown functions. (#4562)
This commit is contained in:
		| @@ -335,8 +335,9 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) | |||||||
|  |  | ||||||
| void ImGui_ImplAllegro5_Shutdown() | void ImGui_ImplAllegro5_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData(); |     ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplAllegro5_InvalidateDeviceObjects(); |     ImGui_ImplAllegro5_InvalidateDeviceObjects(); | ||||||
|     if (bd->VertexDecl) |     if (bd->VertexDecl) | ||||||
|   | |||||||
| @@ -556,8 +556,9 @@ bool    ImGui_ImplDX10_Init(ID3D10Device* device) | |||||||
|  |  | ||||||
| void ImGui_ImplDX10_Shutdown() | void ImGui_ImplDX10_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData(); |     ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplDX10_InvalidateDeviceObjects(); |     ImGui_ImplDX10_InvalidateDeviceObjects(); | ||||||
|     if (bd->pFactory) { bd->pFactory->Release(); } |     if (bd->pFactory) { bd->pFactory->Release(); } | ||||||
|   | |||||||
| @@ -571,8 +571,9 @@ bool    ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co | |||||||
|  |  | ||||||
| void ImGui_ImplDX11_Shutdown() | void ImGui_ImplDX11_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData(); |     ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplDX11_InvalidateDeviceObjects(); |     ImGui_ImplDX11_InvalidateDeviceObjects(); | ||||||
|     if (bd->pFactory)             { bd->pFactory->Release(); } |     if (bd->pFactory)             { bd->pFactory->Release(); } | ||||||
|   | |||||||
| @@ -725,8 +725,9 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO | |||||||
|  |  | ||||||
| void ImGui_ImplDX12_Shutdown() | void ImGui_ImplDX12_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData(); |     ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplDX12_InvalidateDeviceObjects(); |     ImGui_ImplDX12_InvalidateDeviceObjects(); | ||||||
|     delete[] bd->pFrameResources; |     delete[] bd->pFrameResources; | ||||||
|   | |||||||
| @@ -295,8 +295,9 @@ bool ImGui_ImplDX9_Init(IDirect3DDevice9* device) | |||||||
|  |  | ||||||
| void ImGui_ImplDX9_Shutdown() | void ImGui_ImplDX9_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); |     ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplDX9_InvalidateDeviceObjects(); |     ImGui_ImplDX9_InvalidateDeviceObjects(); | ||||||
|     if (bd->pd3dDevice) { bd->pd3dDevice->Release(); } |     if (bd->pd3dDevice) { bd->pd3dDevice->Release(); } | ||||||
|   | |||||||
| @@ -308,8 +308,9 @@ bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks) | |||||||
|  |  | ||||||
| void ImGui_ImplGlfw_Shutdown() | void ImGui_ImplGlfw_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData(); |     ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     if (bd->InstalledCallbacks) |     if (bd->InstalledCallbacks) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -86,8 +86,9 @@ bool    ImGui_ImplOpenGL2_Init() | |||||||
|  |  | ||||||
| void    ImGui_ImplOpenGL2_Shutdown() | void    ImGui_ImplOpenGL2_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplOpenGL2_Data* bd = ImGui_ImplOpenGL2_GetBackendData(); |     ImGui_ImplOpenGL2_Data* bd = ImGui_ImplOpenGL2_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplOpenGL2_DestroyDeviceObjects(); |     ImGui_ImplOpenGL2_DestroyDeviceObjects(); | ||||||
|     io.BackendRendererName = NULL; |     io.BackendRendererName = NULL; | ||||||
|   | |||||||
| @@ -269,8 +269,9 @@ bool    ImGui_ImplOpenGL3_Init(const char* glsl_version) | |||||||
|  |  | ||||||
| void    ImGui_ImplOpenGL3_Shutdown() | void    ImGui_ImplOpenGL3_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); |     ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplOpenGL3_DestroyDeviceObjects(); |     ImGui_ImplOpenGL3_DestroyDeviceObjects(); | ||||||
|     io.BackendRendererName = NULL; |     io.BackendRendererName = NULL; | ||||||
|   | |||||||
| @@ -280,8 +280,9 @@ bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window) | |||||||
|  |  | ||||||
| void ImGui_ImplSDL2_Shutdown() | void ImGui_ImplSDL2_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData(); |     ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     if (bd->ClipboardTextData) |     if (bd->ClipboardTextData) | ||||||
|         SDL_free(bd->ClipboardTextData); |         SDL_free(bd->ClipboardTextData); | ||||||
|   | |||||||
| @@ -1048,8 +1048,9 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend | |||||||
|  |  | ||||||
| void ImGui_ImplVulkan_Shutdown() | void ImGui_ImplVulkan_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData(); |     ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     ImGui_ImplVulkan_DestroyDeviceObjects(); |     ImGui_ImplVulkan_DestroyDeviceObjects(); | ||||||
|     io.BackendRendererName = NULL; |     io.BackendRendererName = NULL; | ||||||
|   | |||||||
| @@ -172,8 +172,9 @@ bool    ImGui_ImplWin32_Init(void* hwnd) | |||||||
|  |  | ||||||
| void    ImGui_ImplWin32_Shutdown() | void    ImGui_ImplWin32_Shutdown() | ||||||
| { | { | ||||||
|     ImGuiIO& io = ImGui::GetIO(); |  | ||||||
|     ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData(); |     ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData(); | ||||||
|  |     IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?"); | ||||||
|  |     ImGuiIO& io = ImGui::GetIO(); | ||||||
|  |  | ||||||
|     // Unload XInput library |     // Unload XInput library | ||||||
| #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD | #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD | ||||||
|   | |||||||
| @@ -73,6 +73,7 @@ Other Changes: | |||||||
| - Fonts: imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL | - Fonts: imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL | ||||||
|   (which apparently happens with Freetype 2.11). (#4394, #4145?). |   (which apparently happens with Freetype 2.11). (#4394, #4145?). | ||||||
| - Fonts: Fixed ImFontAtlas::ClearInputData() marking atlas as not built. (#4455, #3487) | - Fonts: Fixed ImFontAtlas::ClearInputData() marking atlas as not built. (#4455, #3487) | ||||||
|  | - Backends: Added more implicit asserts to detect invalid/redundant calls to Shutdown functions. (#4562) | ||||||
| - Backends: OpenGL3: Fixed our custom GL loader conflicting with user using GL3W. (#4445) [@rokups] | - Backends: OpenGL3: Fixed our custom GL loader conflicting with user using GL3W. (#4445) [@rokups] | ||||||
| - Backends: WebGPU: Fixed for latest specs. (#4472) [@Kangz] | - Backends: WebGPU: Fixed for latest specs. (#4472) [@Kangz] | ||||||
| - Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted via | - Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted via | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user