randr: Fix RRCrtcDetachScanoutPixmap() segfault during server teardown

During server teardown, mrootdraw is NULL, which can cause segfaults if
master->Stop{,Flipping}PixmapTracking() don't do NULL checking. In this case we
shouldn't need to do master->Stop{,Flipping}PixmapTracking() anyway, so just
skip it.

Signed-off-by: Alex Goins <agoins@nvidia.com>
This commit is contained in:
Alex Goins 2019-09-04 12:25:31 -05:00 committed by Aaron Plattner
parent fe439596b9
commit c82f814313

View File

@ -401,17 +401,22 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
if (crtc->scanout_pixmap_back) {
pScrPriv->rrDisableSharedPixmapFlipping(crtc);
master->StopFlippingPixmapTracking(mrootdraw,
crtc->scanout_pixmap,
crtc->scanout_pixmap_back);
if (mrootdraw) {
master->StopFlippingPixmapTracking(mrootdraw,
crtc->scanout_pixmap,
crtc->scanout_pixmap_back);
}
rrDestroySharedPixmap(crtc, crtc->scanout_pixmap_back);
crtc->scanout_pixmap_back = NULL;
}
else {
pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
master->StopPixmapTracking(mrootdraw,
crtc->scanout_pixmap);
if (mrootdraw) {
master->StopPixmapTracking(mrootdraw,
crtc->scanout_pixmap);
}
}
rrDestroySharedPixmap(crtc, crtc->scanout_pixmap);