From aa9f6db6983165de83085476a946df1d632a183a Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 16 Oct 2025 13:48:24 +0200 Subject: [PATCH] Examples: SDL2+DX11, SDL3+DX11, Win32+DX10, Win32+DX11: fixed one resource leak. (#9010, #4350) --- docs/CHANGELOG.txt | 10 ++++++++++ examples/example_sdl2_directx11/main.cpp | 3 +++ examples/example_sdl3_directx11/main.cpp | 3 +++ examples/example_win32_directx10/main.cpp | 3 +++ examples/example_win32_directx11/main.cpp | 3 +++ 5 files changed, 22 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d57ba0a69..34da19b52 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,6 +35,16 @@ HOW TO UPDATE? and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users. - Please report any issue! +----------------------------------------------------------------------- + VERSION 1.92.5 WIP (In Progress) +----------------------------------------------------------------------- + +Docking+Viewports Branch: + +- Examples: SDL2+DX11, SDL3+DX11, Win32+DX10, Win32+DX11: fixed one resource + leak from the use of MakeWindowAssociation() in 1.92.4. (#9010, #4350) [@o-3-o] + + ----------------------------------------------------------------------- VERSION 1.92.4 (Released 2025-10-14) ----------------------------------------------------------------------- diff --git a/examples/example_sdl2_directx11/main.cpp b/examples/example_sdl2_directx11/main.cpp index bbabf55c0..0e4540ef8 100644 --- a/examples/example_sdl2_directx11/main.cpp +++ b/examples/example_sdl2_directx11/main.cpp @@ -261,7 +261,10 @@ bool CreateDeviceD3D(HWND hWnd) // - This must be done for all windows associated to the device. Our DX11 backend does this automatically for secondary viewports that it creates. IDXGIFactory* pSwapChainFactory; if (SUCCEEDED(g_pSwapChain->GetParent(IID_PPV_ARGS(&pSwapChainFactory)))) + { pSwapChainFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER); + pSwapChainFactory->Release(); + } CreateRenderTarget(); return true; diff --git a/examples/example_sdl3_directx11/main.cpp b/examples/example_sdl3_directx11/main.cpp index f0940ae00..cb761a679 100644 --- a/examples/example_sdl3_directx11/main.cpp +++ b/examples/example_sdl3_directx11/main.cpp @@ -256,7 +256,10 @@ bool CreateDeviceD3D(HWND hWnd) // - This must be done for all windows associated to the device. Our DX11 backend does this automatically for secondary viewports that it creates. IDXGIFactory* pSwapChainFactory; if (SUCCEEDED(g_pSwapChain->GetParent(IID_PPV_ARGS(&pSwapChainFactory)))) + { pSwapChainFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER); + pSwapChainFactory->Release(); + } CreateRenderTarget(); return true; diff --git a/examples/example_win32_directx10/main.cpp b/examples/example_win32_directx10/main.cpp index 504502dac..1d7030536 100644 --- a/examples/example_win32_directx10/main.cpp +++ b/examples/example_win32_directx10/main.cpp @@ -246,7 +246,10 @@ bool CreateDeviceD3D(HWND hWnd) // - This must be done for all windows associated to the device. Our DX11 backend does this automatically for secondary viewports that it creates. IDXGIFactory* pSwapChainFactory; if (SUCCEEDED(g_pSwapChain->GetParent(IID_PPV_ARGS(&pSwapChainFactory)))) + { pSwapChainFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER); + pSwapChainFactory->Release(); + } CreateRenderTarget(); return true; diff --git a/examples/example_win32_directx11/main.cpp b/examples/example_win32_directx11/main.cpp index 16b7e2cf2..bdb5f14ee 100644 --- a/examples/example_win32_directx11/main.cpp +++ b/examples/example_win32_directx11/main.cpp @@ -250,7 +250,10 @@ bool CreateDeviceD3D(HWND hWnd) // - This must be done for all windows associated to the device. Our DX11 backend does this automatically for secondary viewports that it creates. IDXGIFactory* pSwapChainFactory; if (SUCCEEDED(g_pSwapChain->GetParent(IID_PPV_ARGS(&pSwapChainFactory)))) + { pSwapChainFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER); + pSwapChainFactory->Release(); + } CreateRenderTarget(); return true;