Date: Sat, 21 Mar 2009 19:41:52 -0700 (PDT)
authorSam Lantinga <slouken@libsdl.org>
Mon, 23 Mar 2009 02:02:30 +0000
changeset 309575483112b97f
parent 3094 c0ce3380742d
child 3096 ae4e80dbe330
Date: Sat, 21 Mar 2009 19:41:52 -0700 (PDT)
From: Mason Wheeler
Subject: [SDL] Critical SDL 1.3 patch

Displaying a window created with SDL_CreateWindowFrom was causing stack overf
lows for me under certain conditions. After far too much work trying to get
Visual Studio's debugger to play nice with a program written in Delphi, I tra
cked it down to a nasty reentrancy cycle in the WndProc handling. Here's a p
atch that fixes the problem
src/video/win32/SDL_win32events.c
     1.1 --- a/src/video/win32/SDL_win32events.c	Sun Mar 22 06:56:37 2009 +0000
     1.2 +++ b/src/video/win32/SDL_win32events.c	Mon Mar 23 02:02:30 2009 +0000
     1.3 @@ -570,6 +570,17 @@
     1.4          }
     1.5          return (0);
     1.6  
     1.7 +        /* If this isn't our window, we don't need to repaint the frame.
     1.8 +           This fixes a reentrancy issue that can cause stack overflows with foreign windows.
     1.9 +           3/21/09 Mason Wheeler */
    1.10 +    case WM_NCPAINT:
    1.11 +        {
    1.12 +            if (SDL_GetWindowFlags(data->windowID) && SDL_WINDOW_FOREIGN) {
    1.13 +                return(0);
    1.14 +            }
    1.15 +            break;
    1.16 +        }
    1.17 +
    1.18          /* We'll do our own drawing, prevent flicker */
    1.19      case WM_ERASEBKGND:
    1.20          {