rootless: Ensure gResizeDeathPix is stored in locally-managed memory rather than re-using the implementation's backing store
The implementation owns the pointer during RootlessStopDrawing and RootlessStartDrawing and is free to (does) change it. Rootless cannot assume ownership of this memory region. This is possibly the cause of some hard to diagnose crashes in XQuartz over the years. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
f71ef2f02f
commit
65ee3248f5
|
@ -1012,7 +1012,12 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
|
||||||
}
|
}
|
||||||
else if (gravity) {
|
else if (gravity) {
|
||||||
/* The general case. Just copy everything. */
|
/* The general case. Just copy everything. */
|
||||||
|
need_window_source = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If necessary, create a source pixmap pointing at the current
|
||||||
|
window bits. */
|
||||||
|
if (need_window_source) {
|
||||||
RootlessStartDrawing(pWin);
|
RootlessStartDrawing(pWin);
|
||||||
|
|
||||||
gResizeDeathBits = xallocarray(winRec->bytesPerRow, winRec->height);
|
gResizeDeathBits = xallocarray(winRec->bytesPerRow, winRec->height);
|
||||||
|
@ -1054,21 +1059,6 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
|
||||||
|
|
||||||
RootlessStartDrawing(pWin);
|
RootlessStartDrawing(pWin);
|
||||||
|
|
||||||
/* If necessary, create a source pixmap pointing at the current
|
|
||||||
window bits. */
|
|
||||||
|
|
||||||
if (need_window_source) {
|
|
||||||
gResizeDeathBounds[0] = (BoxRec) {
|
|
||||||
oldX, oldY, oldX2, oldY2};
|
|
||||||
gResizeDeathPix[0]
|
|
||||||
= GetScratchPixmapHeader(pScreen, oldW, oldH,
|
|
||||||
winRec->win->drawable.depth,
|
|
||||||
winRec->win->drawable.bitsPerPixel,
|
|
||||||
winRec->bytesPerRow, winRec->pixelData);
|
|
||||||
|
|
||||||
SetPixmapBaseToScreen(gResizeDeathPix[0], oldX, oldY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use custom CopyWindow when moving gravity bits around
|
/* Use custom CopyWindow when moving gravity bits around
|
||||||
ResizeWindow assumes the old window contents are in the same
|
ResizeWindow assumes the old window contents are in the same
|
||||||
pixmap, but here they're in deathPix instead. */
|
pixmap, but here they're in deathPix instead. */
|
||||||
|
|
Loading…
Reference in New Issue