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.
(cherry picked from commit 1771edcb44)
This commit is contained in:
Dave Airlie 2008-07-03 18:57:09 +10:00
parent e9f83740e3
commit 793ff6754e

View file

@ -1705,9 +1705,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