Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_compat.c crashes in SDL_SetVideoMode on SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon); #420

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels
worksforme We can't reproduce the bug

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: Windows (XP), x86

Comments on the original bug report:

On 2011-05-24 07:42:21 +0000, Andrey Budko wrote:

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.

On 2011-05-24 07:44:58 +0000, Andrey Budko wrote:

It does not crash if I do not free icon surface

SDL_WM_SetIcon(surface, mask);
//SDL_FreeSurface(surface);

On 2013-05-21 02:41:40 +0000, Sam Lantinga wrote:

Hey Ryan, something for you to check with your SDL 1.2 wrapper.

On 2015-02-18 03:29:31 +0000, Ryan C. Gordon wrote:

(In reply to Sam Lantinga from comment # 2)

Hey Ryan, something for you to check with your SDL 1.2 wrapper.

Noted. :)

--ryan.

@SDLBugzilla SDLBugzilla added bug worksforme We can't reproduce the bug labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
worksforme We can't reproduce the bug
Projects
None yet
Development

No branches or pull requests

1 participant