Correct ref counting of RRMode structures

RRModes are referenced by the resource db, RROutput and RRCrtc structures.
Ensure that the mode reference count is decremented each time a reference is
lost from one of these sources. The missing destroys were in
RRCrtcDestroyResource and RROutputDestroyResource, which only happen at
server reset time, so modes would be unavailable in subsequent server
generations.
This commit is contained in:
Keith Packard 2007-03-15 20:26:07 -07:00 committed by Keith Packard
parent 9d0c3b52f2
commit 2489dae9f7
2 changed files with 6 additions and 1 deletions

View File

@ -361,6 +361,8 @@ RRCrtcDestroyResource (pointer value, XID pid)
}
if (crtc->gammaRed)
xfree (crtc->gammaRed);
if (crtc->mode)
RRModeDestroy (crtc->mode);
xfree (crtc);
return 1;
}

View File

@ -406,9 +406,12 @@ RROutputDestroyResource (pointer value, XID pid)
}
}
}
/* XXX destroy all modes? */
if (output->modes)
{
for (m = 0; m < output->numModes; m++)
RRModeDestroy (output->modes[m]);
xfree (output->modes);
}
for (m = 0; m < output->numUserModes; m++)
RRModeDestroy (output->userModes[m]);