We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1694

Summary: SDL_CreateWindowFrom can lead to stack overflow
Product: SDL Reporter: Jordan Milne <sdlbugs>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: icculus, sdlbugs
Version: HG 2.0   
Hardware: x86   
OS: Windows 7   
See Also: http://bugzilla.libsdl.org/show_bug.cgi?id=1636
Attachments: Repro code for the issue
compressed wmmsg.txt with event logs

Description Jordan Milne 2013-01-12 21:26:44 UTC
Created attachment 1021 [details]
Repro code for the issue

Calling SDL_CreateWindowFrom can lead to a stack overflow in the event handler (WIN_WindowProc.) It doesn't matter whether the window is an SDL window or not. This behaviour doesn't occur under Linux, so this is likely an issue with how event hooking is done in the windows-specific code.

Commenting out the line "return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);" in "video\windows\SDL_windowevents.c" stops the overflow from happening, and a 'printf("%d\n", data->wndproc)' shows that the same wndproc is being called recursively.

Attached is a simple program reproducing the issue.
Comment 1 Jordan Milne 2013-01-12 21:28:20 UTC
Created attachment 1022 [details]
compressed wmmsg.txt with event logs
Comment 2 Ryan C. Gordon 2015-02-18 04:47:12 UTC
This is the same thing as Bug #1636, I think.

--ryan.

*** This bug has been marked as a duplicate of bug 1636 ***