| Summary: | SDL_compat.c crashes in SDL_SetVideoMode on SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon); | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Andrey Budko <e6y> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Windows (XP) | ||
It does not crash if I do not free icon surface SDL_WM_SetIcon(surface, mask); //SDL_FreeSurface(surface); Hey Ryan, something for you to check with your SDL 1.2 wrapper. (In reply to Sam Lantinga from comment #2) > Hey Ryan, something for you to check with your SDL 1.2 wrapper. Noted. :) --ryan. |
This code crashes application: void I_SetWindowIcon(void) { SDL_Surface *surface; Uint8 *mask; int i; // Generate the mask mask = malloc(icon_w * icon_h / 8); memset(mask, 0, icon_w * icon_h / 8); for (i=0; i<icon_w * icon_h; ++i) { if (icon_data[i * 3] != 0x00 || icon_data[i * 3 + 1] != 0x00 || icon_data[i * 3 + 2] != 0x00) { mask[i / 8] |= 1 << (7 - i % 8); } } surface = SDL_CreateRGBSurfaceFrom(icon_data, icon_w, icon_h, 24, icon_w * 3, 0xff << 0, 0xff << 8, 0xff << 16, 0); SDL_WM_SetIcon(surface, mask); SDL_FreeSurface(surface); free(mask); } main() { screen = SDL_SetVideoMode(REAL_SCREENWIDTH, REAL_SCREENHEIGHT, V_GetNumPixelBits(), init_flags); I_SetWindowIcon(); SDL_FreeSurface(screen); screen = NULL; screen = SDL_SetVideoMode(REAL_SCREENWIDTH, REAL_SCREENHEIGHT, V_GetNumPixelBits(), init_flags); } Without I_SetWindowIcon() it works fine. SDL 1.2.14 works fine here.