diff -u /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.c xserver/hw/xfree86/modes/xf86Crtc.c --- /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.c 2008-12-23 11:07:09.000000000 -0500 +++ xserver/hw/xfree86/modes/xf86Crtc.c 2009-02-06 00:15:28.000000000 -0500 @@ -77,6 +77,7 @@ { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (config == NULL) return; config->minWidth = minWidth; config->minHeight = minHeight; config->maxWidth = maxWidth; @@ -93,6 +94,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcPtr crtc, *crtcs; + if (xf86_config == NULL) return NULL; crtc = xcalloc (sizeof (xf86CrtcRec), 1); if (!crtc) return NULL; @@ -148,6 +150,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); int c; + if (xf86_config == NULL) return; (*crtc->funcs->destroy) (crtc); for (c = 0; c < xf86_config->num_crtc; c++) if (xf86_config->crtc[c] == crtc) @@ -176,6 +179,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int o; + if (xf86_config == NULL) return FALSE; for (o = 0; o < xf86_config->num_output; o++) if (xf86_config->output[o]->crtc == crtc) return TRUE; @@ -192,6 +196,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int c, o; + if (xf86_config == NULL) return; for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; @@ -279,6 +284,7 @@ return TRUE; } + if (xf86_config == NULL) return FALSE; adjusted_mode = xf86DuplicateMode(mode); didLock = crtc->funcs->lock (crtc); @@ -616,6 +622,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int len; + if (xf86_config == NULL) return NULL; if (name) len = strlen (name) + 1; else @@ -703,6 +710,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int o; + if (xf86_config == NULL) return; (*output->funcs->destroy) (output); while (output->probed_modes) xf86DeleteMode (&output->probed_modes, output->probed_modes); @@ -729,6 +737,7 @@ ScrnInfoPtr scrn = xf86Screens[screen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (config == NULL) return FALSE; screen->CreateScreenResources = config->CreateScreenResources; if (!(*screen->CreateScreenResources)(screen)) @@ -750,6 +759,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; + if (config == NULL) return FALSE; screen->CloseScreen = config->CloseScreen; xf86RotateCloseScreen (screen); @@ -783,6 +793,8 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; + if (config == NULL) return FALSE; + /* Rotation */ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n"); xf86DisableRandR(); /* Disable old RandR extension support */ @@ -948,6 +960,7 @@ int score; int my_score; + if (config == NULL) return 0; if (n == config->num_output) return 0; output = config->output[n]; @@ -1041,6 +1054,7 @@ int c; int s; + if (config == NULL) return; for (c = 0; c < config->num_crtc; c++) { int crtc_width = 0, crtc_height = 0; @@ -1100,6 +1114,7 @@ int o; Bool user_conf = FALSE; + if (config == NULL) return FALSE; for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -1144,6 +1159,7 @@ int o; int min_x, min_y; + if (config == NULL) return FALSE; for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -1337,6 +1353,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o; + if (config == NULL) return; for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -1536,6 +1553,8 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o; + if (config == NULL) return; + /* When canGrow was TRUE in the initial configuration we have to * compare against the maximum values so that we don't drop modes. * When canGrow was FALSE, the maximum values would have been clamped @@ -1894,6 +1913,7 @@ xf86CrtcPtr crtc; DisplayModePtr last, mode = NULL; + if (config == NULL) return; output = SetCompatOutput(config); if (!output) @@ -2341,6 +2361,8 @@ int width, height; int i = scrn->scrnIndex; + if (config == NULL) return FALSE; + /* Set up the device options */ config->options = xnfalloc (sizeof (xf86DeviceOptions)); memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions)); @@ -2513,6 +2535,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o; + if (config == NULL) return; for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; #if RANDR_GET_CRTC_INTERFACE @@ -2531,6 +2554,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; + if (config == NULL) return; for (c = 0; c < config->num_crtc; c++) { #if RANDR_GET_CRTC_INTERFACE xf86CrtcPtr crtc = config->crtc[c]; @@ -2575,6 +2599,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int c; + if (config == NULL) return FALSE; xf86PrepareOutputs(scrn); xf86PrepareCrtcs(scrn); @@ -2710,10 +2735,13 @@ { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); Bool ok = TRUE; - xf86OutputPtr compat_output = config->output[config->compat_output]; + xf86OutputPtr compat_output; DisplayModePtr compat_mode; int c; + if (config == NULL) return FALSE; + compat_output = config->output[config->compat_output]; + /* * Let the compat output drive the final mode selection */ @@ -2787,6 +2815,7 @@ if (!scrn->vtSema) return; + if (config == NULL) return; if (mode == DPMSModeOff) { for (i = 0; i < config->num_output; i++) { xf86OutputPtr output = config->output[i]; @@ -2838,6 +2867,8 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int o, c; + if (xf86_config == NULL) return; + for (o = 0; o < xf86_config->num_output; o++) { xf86OutputPtr output = xf86_config->output[o]; @@ -2900,6 +2931,7 @@ int size; #endif + if (config == NULL) return; if (output->MonInfo != NULL) xfree(output->MonInfo); @@ -3043,6 +3075,8 @@ int c; BoxRec crtc_box, cover_box; + if (xf86_config == NULL) return NULL; + best_crtc = NULL; best_coverage = 0; crtc_box_ret->x1 = 0; @@ -3121,6 +3155,7 @@ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); xf86_crtc_notify_proc_ptr old; + if (config == NULL) return NULL; old = config->xf86_crtc_notify; config->xf86_crtc_notify = new; return old; @@ -3132,6 +3167,7 @@ ScrnInfoPtr scrn = xf86Screens[screen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (config == NULL) return; config->xf86_crtc_notify = old; } @@ -3141,6 +3177,7 @@ ScrnInfoPtr scrn = xf86Screens[screen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (config == NULL) return; if (config->xf86_crtc_notify) config->xf86_crtc_notify(screen); } @@ -3151,7 +3188,7 @@ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc; - if ((xf86CrtcConfigPrivateIndex == -1) || !xf86_config) + if (xf86_config == NULL) return FALSE; if (xf86_config->num_crtc == 0) diff -u /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.h xserver/hw/xfree86/modes/xf86Crtc.h --- /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.h 2009-01-06 11:21:17.000000000 -0500 +++ xserver/hw/xfree86/modes/xf86Crtc.h 2009-02-05 23:40:28.000000000 -0500 @@ -683,7 +683,10 @@ extern _X_EXPORT int xf86CrtcConfigPrivateIndex; -#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr)) +#define XF86_CRTC_CONFIG_PTR(p) \ + ((xf86CrtcConfigPrivateIndex >= 0) \ + ? (xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr) \ + : NULL) /* * Initialize xf86CrtcConfig structure