sna: Decouple RandR pointers early in CloseScreen

RR resources are freed before CloseScreen (as they are a ServerClient
resource), but on entering our CloseScreen callbacks we are left with a
set of stale pointers. Decouple those before proceeding so that we are
not tempted to dereference them.

Bugzilla: https://bugs.archlinux.org/task/43906
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-03-04 17:12:30 +00:00
parent 88e615425b
commit db82617464
1 changed files with 17 additions and 0 deletions

View File

@ -6292,9 +6292,26 @@ sna_mode_enable(struct sna *sna)
sna->mode.dirty = false;
}
static void sna_randr_close(struct sna *sna)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
int n;
/* The RR structs are freed early during CloseScreen as they
* are tracked as Resources. However, we may be tempted to
* access them during shutdown so decouple them now.
*/
for (n = 0; n < config->num_output; n++)
config->output[n]->randr_output = NULL;
for (n = 0; n < config->num_crtc; n++)
config->crtc[n]->randr_crtc = NULL;
}
void
sna_mode_close(struct sna *sna)
{
sna_randr_close(sna);
sna_mode_wakeup(sna);
if (sna->flags & SNA_IS_HOSTED)