Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 2860 - SetProp must be paired with RemoveProp especially fo…
…r properties added to external windows

Coriiander

Upon creating a window, a window property is added to it through the Win32-function "SetProp". This is done in the SDL-function "SetupWindowData" in file "src\video\windows\SDL_windowswindow.c".

Whenever you call "SetProp" to add a property to a Win32-window, you should also call the Win32-function "RemoveProp" to remove it before destroying that Win32-window.

While you might think that it's ok and that Windows will clean up nicely itself, it is not ok. It is against all Win32-API guidelines and is mostlikely a leak. Especially on external windows (CreateWindowFrom) you want to have things done right, not messy and leaky, affecting some other module. Even if SDL gets shutdown entirely that external window will now forever still have the "SDL_WindowData" prop attached to it.
  • Loading branch information
slouken committed May 28, 2015
1 parent 84ce000 commit 0669a22
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/video/windows/SDL_windowswindow.c
Expand Up @@ -615,6 +615,7 @@ WIN_DestroyWindow(_THIS, SDL_Window * window)

if (data) {
ReleaseDC(data->hwnd, data->hdc);
ReleaseProp(data->hwnd, TEXT("SDL_WindowData"));
if (data->created) {
DestroyWindow(data->hwnd);
} else {
Expand Down

0 comments on commit 0669a22

Please sign in to comment.