SDL resolution change freezes system after upgrading monitor

I recently upgraded from an old 19" CRT monitor to a 22" widescreen
LCD monitor (Samsung 225BW). Immediately after this upgrade,
all applications using SDL in fullscreen mode w/resolution change
started crashing.

I found that I could change X’s resolution with xrandr without any
problems, but when I try to do it with SDL, it’s instant death.

The below test program /only/ crashes when the requested resolution
(w x h) is different from X’s resolution (which in my case is
1680 x 1050, the LCD’s native resolution).

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <SDL.h>
#include <SDL_image.h>

int main(void)
/* Crash the system by switching to 1280 x 800 */
int w = 1280, h = 800, bpp = 24;
SDL_Surface *screen;

      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
              fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());


      screen = SDL_SetVideoMode(w, h, bpp, SDL_FULLSCREEN);
      if (screen == NULL) {
              fprintf(stderr, "Unable to set %dx%d@%d: %s\n",
                              w, h, bpp, SDL_GetError());

      system("touch foo");

      return 0;


When I run this program, the screen turns black and the system
freezes up instantly. The keyboard stops responding, the MP3
player that was running in the background shut up instantly, and
the system(“touch foo”) statement is never run (or at least foo
is not created). The only way out is hitting the reboot button.

Any idea how changing monitors can cause this?
Here’s some system info, in case it matters:

Graphics card: POV GeForce 7800 GT (256 MB VRAM, PCI Express)
CPU: Athlon X2 3800+
Motherboard: ASUS A8N-SLI Premium
RAM: 2 x OCZ 512 MB PC3200
Linux Distro: Slackware 11.0
SDL: 1.2.11
NVIDIA display driver: 1.0-9629
X.Org: 6.9.0
Libc: 2.3.6–

Fixed the problem by upgrading from NVIDIA driver 9629 to the
current version (9746).–