Commit 7115f6c7 authored by Aaron Plattner's avatar Aaron Plattner Committed by Keith Packard
Browse files

randr: unref the provider shared pixmap the appropriate number of times



When an RandR shared pixmap is created in rrCreateSharedPixmap, it has a refcnt
of 1.  Then, PixmapShareToSlave bumps the refcnt to 2.  However, there's no
corresponding PixmapUnshareFromSlave where the refcnt can be decreased again,
and there's no convenient common place where the refcnt can be decremented when
the slave pixmap is destroyed.

Fix this by just unreffing the pixmap twice in RRCrtcDetachScanoutPixmap.
Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent da926901
......@@ -372,6 +372,11 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
if (crtc->scanout_pixmap) {
master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap);
/*
* Unref the pixmap twice: once for the original reference, and once
* for the reference implicitly added by PixmapShareToSlave.
*/
master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
crtc->pScreen->DestroyPixmap(crtc->scanout_pixmap);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment