diff options
author | Michal Srb <msrb@novell.com> | 2013-08-06 16:56:53 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2013-09-10 13:26:26 -0400 |
commit | b902c8abb6d03e68c93e13881a350523b5ac900c (patch) | |
tree | e23e61209e4151b1b7ffdfc5178b1f622a858546 | |
parent | 132507eba93e4dfd466d5c30c9b818cdc6f8536e (diff) |
Xnest: Implement xnestModifyPixmapHeader
Xnest variant of ModifyPixmapHeader that creates new Pixmap in parent X
server if it's size is modified from 0x0 to anything bigger.
xnestCreatePixmap doesn't create pixmap in parent X server if it has
dimensions 0x0. If it is later resized and accessed, Xnest will be
aborted with BadDrawable error from parent X server because it will
use XID 0. This happens with ScratchPixmap, for example as used from
XaceCensorImage. Applications using XACE crash Xnest.
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xnest/Pixmap.c | 15 | ||||
-rw-r--r-- | hw/xnest/Screen.c | 1 | ||||
-rw-r--r-- | hw/xnest/XNPixmap.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index 13e1610fd..2902acd56 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -78,6 +78,21 @@ xnestDestroyPixmap(PixmapPtr pPixmap) return TRUE; } +Bool +xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) +{ + if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { + xnestPixmapPriv(pPixmap)->pixmap = + XCreatePixmap(xnestDisplay, + xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], + width, height, depth); + } + + return miModifyPixmapHeader(pPixmap, width, height, depth, + bitsPerPixel, devKind, pPixData); +} + RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap) { diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 58b5a1199..abb4d372d 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -282,6 +282,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) pScreen->CreatePixmap = xnestCreatePixmap; pScreen->DestroyPixmap = xnestDestroyPixmap; + pScreen->ModifyPixmapHeader = xnestModifyPixmapHeader; /* Font procedures */ diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h index 268ba1e8b..5b2e796fe 100644 --- a/hw/xnest/XNPixmap.h +++ b/hw/xnest/XNPixmap.h @@ -33,6 +33,8 @@ typedef struct { PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool xnestDestroyPixmap(PixmapPtr pPixmap); +Bool xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap); #endif /* XNESTPIXMAP_H */ |