Skip to content

Fix Splash Window (Prevent memory leak when fetching GetDpiForWindow) - #5271

Open
iManGaaX wants to merge 2 commits into
multitheftauto:masterfrom
iManGaaX:patch-1
Open

Fix Splash Window (Prevent memory leak when fetching GetDpiForWindow)#5271
iManGaaX wants to merge 2 commits into
multitheftauto:masterfrom
iManGaaX:patch-1

Conversation

@iManGaaX

Copy link
Copy Markdown

replaced LoadLibrary("user32") with GetModuleHandleA("user32.dll"). LoadLibrary increases the dll is reference count without calling FreeLibrary, causing a resource leak. since user32.dll is already loaded in Win32 gui apps, using GetModuleHandleA safely retrieves the function pointer without leaking memory

replaced LoadLibrary("user32") with GetModuleHandleA("user32.dll"). LoadLibrary increases the dll is reference count without calling FreeLibrary, causing a resource leak. since user32.dll is already loaded in Win32 gui apps, using GetModuleHandleA safely retrieves the function pointer without leaking memory
@iManGaaX iManGaaX changed the title fix(splash): prevent memory leak when fetching GetDpiForWindow Fix Splash Window (prevent memory leak when fetching GetDpiForWindow) Aug 26, 2026
@iManGaaX iManGaaX changed the title Fix Splash Window (prevent memory leak when fetching GetDpiForWindow) Fix Splash Window (Prevent memory leak when fetching GetDpiForWindow) Aug 26, 2026
@botder

botder commented Aug 26, 2026

Copy link
Copy Markdown
Member

There is no resource leak. You are never going to unload user32.dll in a process.

@iManGaaX

Copy link
Copy Markdown
Author

There is no resource leak. You are never going to unload user32.dll in a process.

The intention was just to follow best practices by avoiding unnecessary reference count increments when GetModuleHandleA is sufficient for already loaded modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants