| Summary: | SDL_UpdateWindowSurface() failed for resized window | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Koichi Yoshida <koichi.yoshida> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | 2.0.9 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
reproducible code
reproducible code ver2 |
||
*** Bug 4741 has been marked as a duplicate of this bug. *** The documentation says you need to call SDL_GetWindowSurface to obtain a valid surface, whenever the window is resized. Thank you for replying to my post. I am sorry for duplicating. After the window has been resized, the reproducible code calls SDL_GetWindowSurface (). This is correct? Created attachment 3906 [details]
reproducible code ver2
TEST_CASE 0 shows the SIGSEGV case.
TEST_CASE 1~3 shows how to avoid the SIGSEGV.
I found the problem looks like caused by timing. If it sleeps 1 seconds after SDL_SetWindowSize(), it works correctly (TEST_CASE 2&3). Also, if it cancels drawing when the surface width and height has not been changed correctly, it works correctly (TEST_CASE 1&3). |
Created attachment 3901 [details] reproducible code I found a problem that SDL_UpdateWindowSurface() failed for a window resized by SDL_SetWindowSize(). The window is created as "not full screen" and resizable. I have attached a reproducible code for the problem. Tested environment: debian 10.0.0 amd64 sdl2.0.9+dfsg1-1 How to reproduce the problem: gcc sdl2_UpdateWindowSurface_failed.c -lSDL2 && ./a.out In case of SDL_UpdateWindowSurface() failed, you can see an error message as follows. > SDL_UpdateWindowSurface failed: Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface