modes: check the crtc is valid before using its desired modes.

this fixes a crash I was getting on radeon rotate when gnome is running.
I'm sure g-s-d was doing something bad, but really not crashing ftw.
This commit is contained in:
Dave Airlie 2008-07-03 18:57:09 +10:00 committed by Dave Airlie
parent 689292e58c
commit 1771edcb44

View File

@ -1714,9 +1714,11 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
/* Set scrn->modes to the mode list for the 'compat' output */
scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
for (mode = scrn->modes; mode; mode = mode->next)
if (xf86ModesEqual (mode, &crtc->desiredMode))
break;
if (crtc) {
for (mode = scrn->modes; mode; mode = mode->next)
if (xf86ModesEqual (mode, &crtc->desiredMode))
break;
}
if (scrn->modes != NULL) {
/* For some reason, scrn->modes is circular, unlike the other mode