[SDL] SDL 1.3 freeze in SDL_PumpEvents

ebyard e_byard at yahoo.co.uk
Mon Dec 27 07:26:02 PST 2010

Hmmm well, I have managed to hack a fix for now - can someone with in depth knowledge of this area check this code is correct?

In function WIN_WindowProc, there is a variable "returnCode" which is initialise to -1.

If the window gets a WM_PAINT message, the following code is executed:


    case WM_PAINT:
            RECT rect;
            if (GetUpdateRect(hwnd, &rect, FALSE)) {
                ValidateRect(hwnd, &rect);
                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED,
                                    0, 0);
        returnCode = 0;

Now with returnCode set to 0, the following is executed:


    /* If there's a window proc, assume it's going to handle messages */
    if (data->wndproc) {
        return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);
    } else if (returnCode >= 0) {
        return returnCode;
    } else {
        return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);

No window proc exists, and so the function returns 0 and the program just locks up with (I guess) an event queue which is overflowing.
If returnCode is set to -1 (my hack fix) then it will do the CallWindowProc(DefWindowProc......) and this seems to work very well, returning to my code which handles the event.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101227/89e6fa0a/attachment-0008.htm>

More information about the SDL mailing list