SDL 1.3 freeze in SDL_PumpEvents

Hi

I have a strange freeze-up in SDL_PumpEvents, or to be more specific, WIN_PumpEvents. It will just totally freeze, dispatching messages for the 2nd of my 2 windows, which constantly gets a WM_PAINT message but nothing happens.

I’m not massively knowledgable on this area of SDL (assumed it’s much the same as SDL 1.2) - so can anyone suggest what’s going on and how to fix it?

Thanks
Ed

A bit more information:

Seems that the event SDL_WINDOWEVENT_EXPOSED is trying to be added to the event queue by SDL_PushEvent but this returns 0 - so it is failing. I guess it’s overflowing
the event queue.

I assume I need to handle this event somehow, but I don’t know quite how!

I have one function which checks for events and handles all the ones I need to handle, but the problem is that the freeze occurs in the SDL code, before my code can
handle anything.

Thanks
Ed

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:

Code:

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

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

Code:

/* 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.

Thanks
Ed

Can you post a link to code that has the problem? I’d like to try to
reproduce it here.

Thanks!On Mon, Dec 27, 2010 at 6:04 AM, ebyard <e_byard at yahoo.co.uk> wrote:

Hi

I have a strange freeze-up in SDL_PumpEvents, or to be more specific,
WIN_PumpEvents. It will just totally freeze, dispatching messages for the
2nd of my 2 windows, which constantly gets a WM_PAINT message but nothing
happens.

I’m not massively knowledgable on this area of SDL (assumed it’s much the
same as SDL 1.2) - so can anyone suggest what’s going on and how to fix it?

Thanks
Ed


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


? ? -Sam Lantinga, Founder and President, Galaxy Gameworks LLC