The bug is in stub/win32/winmain.c
SDL_RegisterApp() is currently called after SDL_Init().
It should be called before.
I hope SDL_RegisterApp()
does not use any resource that must be initialized by
SDL_Init(), otherwise we have a problem there…
description:
In some cases SDL_Init()
causes CreateWindow() to be called, and in the current case
SDL_Instance is not set, because it is set only after
SDL_RegisterApp() has been called.
The case when SDL_Init() calls CreateWindow() occurs when
DDRAW.DLL is not present, i.e. the fallback sdl-DIB.dll
library is used.
The call sequence is:
SDL_Init
_SDL_Init
SDL_VideoInit
SDL_SYS_VideoInit
SDL_CreateWindow
CreateWindow
kaboom!
-t
description:
In some cases SDL_Init()
causes CreateWindow() to be called, and in the current case
SDL_Instance is not set, because it is set only after
SDL_RegisterApp() has been called.
The case when SDL_Init() calls CreateWindow() occurs when
DDRAW.DLL is not present, i.e. the fallback sdl-DIB.dll
library is used.
The call sequence is:
SDL_Init
_SDL_Init
SDL_VideoInit
^^^^???
SDL_VideoInit() should not be called when SDL_Init(0) is called in the
main function in winmain.c
Can you verify that it is indeed being called when using the latest CVS
(or development) version of SDL?
SDL_SYS_VideoInit
SDL_CreateWindow
CreateWindow
kaboom!
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec
Sam Lantinga wrote:
description:
In some cases SDL_Init()
causes CreateWindow() to be called, and in the current case
SDL_Instance is not set, because it is set only after
SDL_RegisterApp() has been called.
The case when SDL_Init() calls CreateWindow() occurs when
DDRAW.DLL is not present, i.e. the fallback sdl-DIB.dll
library is used.
The call sequence is:
SDL_Init
_SDL_Init
SDL_VideoInit
^^^^???
SDL_VideoInit() should not be called when SDL_Init(0) is called in the
main function in winmain.c
I see… this may be my mistake: I had to use SDL in a thread that is
not
the main thread, so since I ripped of the code in winmain.c to call
it from my thread, but I was calling SDL_Init(SDL_INIT_VIDEO),
not SDL_Init(0).
So, if I understand well, the correct order to call things is:
SDL_Init(0)
SDL_RegisterApp(…)
SDL_Init(SDL_INIT_VIDEO)
correct ?
-t