I currently have an Ogre/SDL setup, and I’m trying change the way my windows in both libraries are bound from the old way (where SDL makes the window and I pass the handle into Ogre), into the new way available to me in SDL 1.3 (where I pass the window handle into SDL after Ogre makes it) since I am sure this will clean up a bunch of code and potentially fix some issues.
When I try to do this however, it crashes. Here is my initialization code:
Code:
OgreWindow = Ogre::Root::getSingleton().createRenderWindow(WindowCaption, Settings.RenderWidth, Settings.RenderHeight, Settings.Fullscreen, &Opts);
HWND Data = 0;
OgreWindow->getCustomAttribute(“WINDOW”,&Data);
SDLWindow = SDL_CreateWindowFrom(&Data);
This is on Windows in case you couldn’t tell, btw. The first thing that seems to go wrong is when SDL calls “SetProp” in the Windows API, it returns false. Which then SDL begins to destruct the window, and it gets all the way to line 115 of SDL_windowsframebuffer.c before seg faulting when it tried to dereference the SDL window data pointer. Here is the code (in my version) where it does that:
Code:
void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
__if (data->mdc) {__
DeleteDC(data->mdc);
data->mdc = NULL;
}
The line with the underscores is where it crashes(not because of the underscores, I added those for clarity ). So far I’ve checked the HWND I’m passing in and it looks valid. I can also verify the window is being created visually just before the crash. I’ve also checked my Ogre log for any hints of the construction going wrong and found nothing. So I’m currently suspecting this is an issue on SDL’s end. I have no idea where to go from here. Any help or insights would be greatly appreciated.