Sdl X11 dual monitor crash bug

I can reproducibly have a crash in SDL with isolated code.

This crash was produced on Redhat 9.0 with SDL 1.2.6-1.i386.rpm from
the official website. I cannot produce this crash with the
SDL-1.2.5-3.i386.rpm that ships with Redhat 9.

The below code was compiled with:
g++ sdl-config --libs --cflags -g

This bug only happens in fullscreen. Unfortunately, I cannot get a
backtrace if I am running SDL in fullscreen. I have to kill -9 the
process, which causes gdb to segfault if you request a backtrace
afterwards. However, I can supply the following information:

Begin GDB output----------------
0x4004dd70 in set_best_resolution (this=0x8049ea8, width=1024, height=768)
at SDL_x11modes.c:139
139 if ( (modes[i]->hdisplay != mode.hdisplay) ||

End GDB output

This only occurs when I have both of my monitors enabled. I run dual
monitors: one at 1600x1200x32bpp @85hz and the other at
1280x1024x32bpp @85hz. I am not running Xinerama. My video card is a
GeForce ti4200 running Nvidia’s binary drivers.

When I run only using the primary monitor (1600x1200x32bpp @85hz), the
crash is nonexistant. The way my XF86Config is configured, I don’t
specify a wide array of video modes when in dual monitor layout, but
in single monitor layout (which I use for gaming), I specify many,
including 1024x768, which is what the code below highlights.

My XF86Config is available here:
http://shambler.dhs.org/~sludge/XF86Config

X -version returns 4.3 (Redhat 9 stock). I am running Gnome.

SDL seems to build a white square, and then it simply exits.

Let me know if there is a better place to report bugs, or if I can be
of further help.

Begin code

#include
#include
#include<SDL.h>

using namespace std;

int main( int argc, char **argv )
{
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE |
SDL_INIT_JOYSTICK ) < 0 )
{
cerr << "Unable to init SDL video: " << SDL_GetError() <<
endl;

    exit(1);
}

cout << "SDL_Init returned properly... Now, let's try
SDL_SetVideoMode" << endl;

SDL_Surface *screen = SDL_SetVideoMode( 1024, 768, 32,
    SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF );

cout << "If we're printing this, we're doing better than expected." << endl;

}


Michael L. Labbe
http://www.threewavesoftware.com
(604)552-9283 8:00am-6:00pm PST

Can you try applying this fix (in CVS);

— SDL-1.2.6/src/video/x11/SDL_x11modes.c 2003-08-30
20:13:12.000000000 +0100
+++ SDL-1.2.6-fix/src/video/x11/SDL_x11modes.c 2003-09-02
01:40:57.000000000 +0100
@@ -120,7 +120,7 @@
goto match;
}
qsort(modes, nmodes, sizeof *modes, cmpmodes);

  •        for ( i = nmodes-1; i >= 0 ; i-- ) {
    
  •        for ( i = nmodes-1; i > 0 ; i-- ) {
              if ( ! best_width ) {
                   if ( (modes[i]->hdisplay >= width) &&
                        (modes[i]->vdisplay >= height) ) {On Mon, 2003-10-06 at 11:38, Michael L. Labbe wrote:
    

I can reproducibly have a crash in SDL with isolated code.

This crash was produced on Redhat 9.0 with SDL 1.2.6-1.i386.rpm from
the official website. I cannot produce this crash with the
SDL-1.2.5-3.i386.rpm that ships with Redhat 9.

The below code was compiled with:
g++ sdl-config --libs --cflags -g

This bug only happens in fullscreen. Unfortunately, I cannot get a
backtrace if I am running SDL in fullscreen. I have to kill -9 the
process, which causes gdb to segfault if you request a backtrace
afterwards. However, I can supply the following information:

Begin GDB output

0x4004dd70 in set_best_resolution (this=0x8049ea8, width=1024, height=768)
at SDL_x11modes.c:139
139 if ( (modes[i]->hdisplay != mode.hdisplay) ||

End GDB output

This only occurs when I have both of my monitors enabled. I run dual
monitors: one at 1600x1200x32bpp @85hz and the other at
1280x1024x32bpp @85hz. I am not running Xinerama. My video card is a
GeForce ti4200 running Nvidia’s binary drivers.

When I run only using the primary monitor (1600x1200x32bpp @85hz), the
crash is nonexistant. The way my XF86Config is configured, I don’t
specify a wide array of video modes when in dual monitor layout, but
in single monitor layout (which I use for gaming), I specify many,
including 1024x768, which is what the code below highlights.

My XF86Config is available here:
http://shambler.dhs.org/~sludge/XF86Config

X -version returns 4.3 (Redhat 9 stock). I am running Gnome.

SDL seems to build a white square, and then it simply exits.

Let me know if there is a better place to report bugs, or if I can be
of further help.


Alan.

“One must never be purposelessnessnesslessness.”
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031006/ca0318e9/attachment.pgp

Michael L. Labbe wrote:

I can reproducibly have a crash in SDL with isolated code.

This crash was produced on Redhat 9.0 with SDL 1.2.6-1.i386.rpm from
the official website. I cannot produce this crash with the
SDL-1.2.5-3.i386.rpm that ships with Redhat 9.

The below code was compiled with:
g++ sdl-config --libs --cflags -g

This bug only happens in fullscreen. Unfortunately, I cannot get a
backtrace if I am running SDL in fullscreen. I have to kill -9 the
process, which causes gdb to segfault if you request a backtrace
afterwards.

You could debug that one of the following ways :

  • add an initial sleep() instruction to your program, then attach the
    debugger by hand to the process using gdb <a.out> on a text console
  • or similarly, on a text console, export DISPLAY=:0.0 and gdb ./a.out
  • #define XFREE86_DEBUG at the beggining of
    SDL12/src/video/x11/SDL_x11modes.c and recompile SDL

Stephane