# # Updated but not checked in: # (will commit) # # modified: src/radeon_driver.c # # # Untracked files: # (use "git add" to add to commit) # # megapatch_fix.patch diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 403078e..815cab8 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -4364,7 +4364,8 @@ static Bool RADEONPreInitModes(ScrnInfoP /* Sort the modes, retain the first */ if (pScrn->modes && (start = pScrn->modes->next)) { - for (mp = start; mp->next != pScrn->modes; mp = mp->next) { + /* Copy modelist into a new sorted modelist */ + for (mp = start; mp != pScrn->modes; mp = mp->next) { DisplayModePtr new = NULL; new = xnfcalloc(1, sizeof (DisplayModeRec)); @@ -4374,14 +4375,18 @@ static Bool RADEONPreInitModes(ScrnInfoP } if (last && first) { + /* Clean up the old modelist */ + start->prev = pScrn->modes->prev; + if (start->prev) + start->prev->next = start; + while (start) + xf86DeleteMode(&start, start); + + /* Switch to the new sorted modelist */ pScrn->modes->next = first; pScrn->modes->prev = last; first->prev = pScrn->modes; - /* Make the list circular */ last->next = pScrn->modes; - - for (mp = start; mp->next != pScrn->modes; mp = mp->next) - xf86DeleteMode(&start, mp); } }