Problem to destroy window with SDL 1.3

Hi everybody,

I wrote the following source code and I have a problem to destroy SDL objects.

{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Error initializing SDL: %s\n”, SDL_GetError());
}
windowId=SDL_CreateWindowFrom((void*)widget->winId());
if(windowId == 0) {
qDebug()<<SDL_GetError();
}

renderer=SDL_CreateRenderer(windowId ,-1,0);

if (!renderer) {
    qDebug()<<SDL_GetError();
}

/* Loop, waiting for QUIT or the escape key */

SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer,255,255,255,0);
SDL_RenderPresent(renderer);
//    SDL_DestroyRenderer(renderer);

SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(windowId);

SDL_Quit();

}

when I run it in Debug mode, i get the following message:

Program received signal SIGSEGV, Segmentation fault.
IME_HandleMessage (hwnd=0x1b07b4, msg=70, wParam=0, lParam=0x28cbc4,
videodata=0x0) at src/video/windows/SDL_windowskeyboard.c:837
837 if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled)
Current language: auto; currently c
(gdb) Error: dll starting at 0x77510000 not found.
Error: dll starting at 0x76900000 not found.
Error: dll starting at 0x77510000 not found.
Error: dll starting at 0x77630000 not found.

This error appears only when SDL_DestroyWindow(windowId) or SDL_Quit()are called.

if I replace
windowId=SDL_CreateWindowFrom((void*)widget->winId());
by
windowId = SDL_CreateWindow=SDL_CreateWindow(“Example”,SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,512, 384, SDL_WINDOW_SHOWN);
the error no longer appears

Could you help me to find the cause of this error ?

Thanks a lot

Cyrille Herlem

Could you help me to find the cause of this error ?

Can you rebuild SDL 1.3 with this attached patch? It should fix this
crash, I think, but I don’t have any way to test it here.

–ryan.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL13-windows-restore-winproc-RYAN1.diff
Type: text/x-diff
Size: 950 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110725/165e2c52/attachment.diff

Hi Ryan,

Thanks for this answer,

I applied the patch, and now it works fine.

Best regards
Cyrille