We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1403 - Creating a window with GL and resizable flags may crash
Summary: Creating a window with GL and resizable flags may crash
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Linux
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-28 12:07 UTC by jordirovira
Modified: 2012-02-03 19:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jordirovira 2012-01-28 12:07:39 UTC
It can be reproduced by taking the testgl2.c example and adding this at line 217

    state->window_flags |= SDL_WINDOW_RESIZABLE;

When a window is created with a resiable flag on linux (and i think osx) there are uninitialised variables being used which can try to create a window with strange sizes. This is according to valgrind, in the window creation function.

This sometimes crashes the window manager. And sometimes works fine.
Comment 1 jordirovira 2012-02-03 10:26:28 UTC
I finally have time to look into this and I have found it:

in SDL_x11window around 520:

    /* Setup the normal size hints */
    if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
        sizehints.min_width = sizehints.max_width = window->w;
        sizehints.min_height = sizehints.max_height = window->h;
        sizehints.flags = PMaxSize | PMinSize;
    }
    sizehints.x = window->x;
    sizehints.y = window->y;
    sizehints.flags |= USPosition;

the sizehints.flags member is not initizalised if it doesn't enter the conditional. It is as easy as setting it to zero before the conditional.
Comment 2 Sam Lantinga 2012-02-03 19:25:01 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/963497e37d34