summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2007-03-15 20:26:07 -0700
committerKeith Packard <keithp@guitar.keithp.com>2007-03-15 20:26:07 -0700
commitf521308ad2c06afa00143d3ab407e18d5293d497 (patch)
treeda327fa32bafca609a650edb7bb95df67d4e271d
parentb14f003b0ed1252766c9e3b1c086ea2809521047 (diff)
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.
-rw-r--r--randr/rrcrtc.c2
-rw-r--r--randr/rroutput.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 43a6fcac9..1b3c230f5 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -370,6 +370,8 @@ RRCrtcDestroyResource (pointer value, XID pid)
}
if (crtc->gammaRed)
xfree (crtc->gammaRed);
+ if (crtc->mode)
+ RRModeDestroy (crtc->mode);
xfree (crtc);
return 1;
}
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 31ec92421..09f2afd87 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -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]);