[SDL] Stack overflow when initializing video subsystem

Urs Dönni urs_doenni at gmx.ch
Thu Mar 29 10:23:37 PDT 2007


Hello,

I get a stack overflow when initializing the video subsystem (when
OpenGL is enabled)
SDL works just fine when I let it run it it's own window, but what I'm
trying to do now is to embed it into a widget of my application. I can
disable OpenGL, then I can run SDL applications that use only 2D
without any problems.

Some more information about the system I'm using:
I'm using windows server 2003. SDL Version: 1.2.11. The problem also
happens for other people on other machines (specifically: machine
running windows vista).
I use the Eiffel Language Binding (http://eiffelmedia.origo.ethz.ch).
I'm trying to embed it into a Vision2 widget
(http://docs.eiffel.com/eiffelstudio/libraries/vision2/00_introduction.html),
which is just a wrapper for the native windows widgets.

The stack overflow happens when I call SDL_SetVideoMode, and sometime
later WinMessage calls DIB_HandleMessage which then goes back to
WinMessage and so on.

I'll try to be more specific on where the overflow occurs:

I call SDL_SetVideoMode (here I fill in the values that are used in the call)
SDL_SetVideoMode (640, 480, 32, 0x00000002)
The crash also occured when I played around with the flags, just as
soon as I enable OpenGL it crashes.

What happens then is:
SDL_SetVideoMode -> DIB_SetVideoMode -> WIN_GL_SetupWindow ->
Init_WGL_ARB_extensions -> [some calls in user32.dll, ntdll.dll,
kernel32.dll] -> WinMessage.

That's where the problems start:
WinMessage (from sdl_sysevents.c) gets called with msg=0x00000081.
This message seems to be unknown, so the function HandleMessage gets
called. This calls DIB_HandleMessage (sdl_dibevents.c), which also
doesn't know the message code, and calls CallWindowProc again - which,
after some calls in user32.dll and so on, returns to WinMessage. So I
get a stack overflow because WinMessage calls DIB_HandleMessage which
then goes back to WinMessage.

I have attached the stack trace.

What I've tried is modifying sdl_dibevents.c to protect the function
from being called recursively. Then my application starts, but I only
see a black screen (when OpenGL is enabled, 2D works fine with this
hack).

Any ideas on what could be wrong here, where I could look for problems
or how to give you more information to help me would be greatly
appreciated.

Regards,
Urs
-------------- next part --------------
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4a66c)  Line 253	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4a66c)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4aca8)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4aca8)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4b2e4)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4b2e4)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4b920)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4b920)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4bf5c)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4bf5c)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4c598)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4c598)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4cbd4)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4cbd4)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4d210)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4d210)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4d84c)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4d84c)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4de88)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4de88)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	ntdll.dll!7c830798() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4e4c4)  Line 253 + 0x1d bytes	C
>	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4e4c4)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	ntdll.dll!7c8302e7() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c833139() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x04bf2fc0, HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4eb00)  Line 253 + 0x1d bytes	C
 	SDL.dll!WinMessage(HWND__ * hwnd=0x00080bfe, unsigned int msg=0x00000081, unsigned int wParam=0x00000000, long lParam=0x06a4eb00)  Line 722 + 0x1d bytes	C
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!77395589() 	
 	vision.exe!_cwel_window_procedure at 16()  + 0x5c bytes	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!7739ca95() 	
 	user32.dll!773a9b49() 	
 	user32.dll!773ad03f() 	
 	SDL.dll!DIB_HandleMessage(SDL_VideoDevice * this=0x7c833498, HWND__ * hwnd=0x06a4efcc, unsigned int msg=0x10081dd7, unsigned int wParam=0x04bf2fc0, long lParam=0x00080bfe)  Line 253 + 0x1d bytes	C
 	ntdll.dll!7c833488() 	
 	ntdll.dll!7c8302e7() 	
 	ntdll.dll!7c82fadf() 	
 	ntdll.dll!7c82fb23() 	
 	ntdll.dll!7c83aa25() 	
 	ntdll.dll!7c833498() 	
 	ntdll.dll!7c833637() 	
 	ntdll.dll!7c83375b() 	
 	ntdll.dll!7c83368f() 	
 	user32.dll!7739c3b7() 	
 	user32.dll!7739c484() 	
 	user32.dll!7739c43a() 	
 	ntdll.dll!7c82f9c1() 	
 	user32.dll!7739ca68() 	
 	user32.dll!773948bf() 	
 	ntdll.dll!7c82ec9e() 	
 	user32.dll!77394855() 	
 	user32.dll!77391439() 	
 	ntdll.dll!7c832b7f() 	
 	ntdll.dll!7c833f60() 	
 	ntdll.dll!7c833f28() 	
 	kernel32.dll!77e63028() 	
 	kernel32.dll!77e41d93() 	
 	ntdll.dll!7c8300c6() 	
 	ntdll.dll!7c82f9dd() 	
 	ntdll.dll!7c82f5a0() 	
 	ntdll.dll!7c831fb2() 	
 	ntdll.dll!7c831fb2() 	
 	ntdll.dll!7c831fe4() 	
 	user32.dll!77394a07() 	
 	user32.dll!7738e988() 	
 	SDL.dll!Init_WGL_ARB_extensions(SDL_VideoDevice * this=0x04bf2fc0)  Line 123 + 0x2f bytes	C
 	SDL.dll!WIN_GL_SetupWindow(SDL_VideoDevice * this=0x04bf2fc0)  Line 227 + 0x9 bytes	C
 	SDL.dll!DIB_SetVideoMode(SDL_VideoDevice * this=0x04bf2fc0, SDL_Surface * current=0x04bf3538, int width=0x00000280, int height=0x000001e0, int bpp=0x00000020, unsigned int flags=0x00000002)  Line 820 + 0x9 bytes	C
 	SDL.dll!SDL_SetVideoMode(int width=0x00000280, int height=0x000001e0, int bpp=0x00000020, unsigned int flags=0x00000002)  Line 667 + 0x20 bytes	C
 	vision.exe!Fjvhflq(char * Current=0x04ca8f48, int arg1=0x00000280, int arg2=0x000001e0, int arg3=0x00000020, int arg4=0x60000002)  Line 915 + 0x15 bytes	C
 	vision.exe!Fl3m41i(char * Current=0x04ca8f48)  Line 216 + 0x2c bytes	C
 	vision.exe!toc6(char * (char *, <no type>)* ptr=0x015a6ea0)  Line 509 + 0x7 bytes	C
 	vision.exe!_dynamic_eval()  + 0x4da bytes	
 	vision.exe!_xinitint()  + 0x407b bytes	
 	vision.exe!_xinterp()  + 0x174 bytes	
 	vision.exe!toi6(char * Current=0x04ca7338)  Line 500 + 0xf bytes	C
 	vision.exe!_fAahk17l(void (char *)* f_ptr=0x00000000, EIF_TYPED_ELEMENT * closed=0x04ca88b8, EIF_TYPED_ELEMENT * open=0x00000000)  Line 1364 + 0x27 bytes	C
 	vision.exe!inline_Fmrmqcp(void * arg1=0x00405e25, void * arg2=0x00000000, void * arg3=0x04ca88b8, void * arg4=0x00000000, int arg5=0x000003e9, int arg6=0x000001a1, unsigned char arg7=0x00, unsigned char arg8=0x00, unsigned char arg9=0x00, int arg10=0x00000001, int arg11=0x00000000, void * arg12=0x00000000)  Line 35 + 0xf bytes	C
 	vision.exe!Fmrmqcp(char * Current=0x04ca88e8, void * arg1=0x00405e25, void * arg2=0x00000000, void * arg3=0x04ca88b8, void * arg4=0x00000000, int arg5=0x000003e9, int arg6=0x000001a1, unsigned char arg7=0x00, unsigned char arg8=0x00, unsigned char arg9=0x00, int arg10=0x00000001, int arg11=0x00000000, void * arg12=0x00000000)  Line 169 + 0x35 bytes	C
 	vision.exe!Fmrl2e2(char * Current=0x04ca88e8, char * arg1=0x00000000)  Line 131 + 0x49 bytes	C
 	vision.exe!Fa28f90(char * Current=0x04ca8e60)  Line 107 + 0x22 bytes	C
 	vision.exe!Fa24kn9(char * Current=0x04ca8e60)  Line 173 + 0x19 bytes	C
 	vision.exe!fAaa2eh4(char * Current=0x04ca8e60)  Line 1482 + 0x1e bytes	C
 	vision.exe!_eif_thr_create_with_args()  + 0x74d bytes	
 	vision.exe!_callthreadstart()  Line 293 + 0x6 bytes	C
 	vision.exe!_threadstart(void * ptd=0x052eb850)  Line 275 + 0x5 bytes	C
 	kernel32.dll!77e6608b() 	


More information about the SDL mailing list