From 3c6939693bfcf7ef4970be2e2c619a6f2666e307 Mon Sep 17 00:00:00 2001 From: eugenesvk Date: Thu, 16 May 2024 16:53:31 +0700 Subject: [PATCH] fix: prevent GDI resource leak (DC) on getting DPI --- native-windows-gui/src/win32/high_dpi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/native-windows-gui/src/win32/high_dpi.rs b/native-windows-gui/src/win32/high_dpi.rs index 3d23bd07..bd4d86e8 100644 --- a/native-windows-gui/src/win32/high_dpi.rs +++ b/native-windows-gui/src/win32/high_dpi.rs @@ -58,5 +58,6 @@ pub unsafe fn dpi() -> i32 { use winapi::um::wingdi::LOGPIXELSX; let screen = GetDC(std::ptr::null_mut()); let dpi = GetDeviceCaps(screen, LOGPIXELSX); + let _ = ReleaseDC(std::ptr::null_mut(),screen); dpi }