Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows - Subclassing an SDL window causes infinite recursion (and ultimately stack overflow) #8519

Closed
maamert opened this issue Nov 9, 2023 · 2 comments
Assignees
Labels
abandoned Bug has been abandoned for various reasons waiting Waiting on user response
Milestone

Comments

@maamert
Copy link

maamert commented Nov 9, 2023

For context, this is using the Subclassing technique described here.

Ultimately, if an SDL window is immediately subclassed when created, then SDL will overwrite the Window Procedure of the window with its own: https://github.com/libsdl-org/SDL/blob/23db9716814bfad469227a5d7069dc1898310d96/src/video/windows/SDL_windowswindow.c#L334C11-L334C11

Then, during any Window Message, infinite recursion happens as the following way:

  1. The now-overwritten Window Procedure (WIN_WindowProc) is called.
  2. At the end, WIN_WindowProc then calls the subclassed window procedure: https://github.com/libsdl-org/SDL/blob/23db9716814bfad469227a5d7069dc1898310d96/src/video/windows/SDL_windowsevents.c#L1740C24-L1740C24
  3. This is the subclassed window procedure. At the end, because it's a well-behaving subclass window procedure, will call DefSubclassProc. This then ultimately calls the original Window procedure, which is... WIN_WindowProc. Go to step 2.
@slouken
Copy link
Collaborator

slouken commented Nov 9, 2023

Can you attach a simple example for testing?

@slouken slouken self-assigned this Nov 9, 2023
@slouken slouken added this to the 2.30.0 milestone Nov 9, 2023
@slouken slouken added the waiting Waiting on user response label Nov 22, 2023
@slouken
Copy link
Collaborator

slouken commented Dec 24, 2023

We're releasing SDL 2.30 soon and haven't heard back, so I'm going ahead and closing this for now. Feel free to add more information and reopen it if you're still having this issue.

@slouken slouken closed this as not planned Won't fix, can't repro, duplicate, stale Dec 24, 2023
@slouken slouken added the abandoned Bug has been abandoned for various reasons label Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned Bug has been abandoned for various reasons waiting Waiting on user response
Projects
None yet
Development

No branches or pull requests

2 participants