diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2020-10-28 12:17:23 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2020-10-31 09:24:47 -0700 |
commit | 033ed8bf196b1cddd681a9b32d9398bf6bc02d24 (patch) | |
tree | 271d6f24e41ab310f0b4e2430a2fd97ce1f04a11 /devices/gdevx.c | |
parent | 36568c21f45ed0686abec8316f56bc171ab416a8 (diff) | |
download | ghostpdl-033ed8bf196b1cddd681a9b32d9398bf6bc02d24.tar.gz |
Bug 702671: Make sure X11 device cleans up with closure
The issue is that the pdf14 device will close and reopen the
target device under certain cases and the X11 devices were not
cleaning themselves up sufficiently. Also added a finalize
method where the call to XCloseDisplay should actually be made.
The pdf14 device does this close and open dance to ensure that
the page_has_transparency parameter will be set in the device.
It is possible that we could end up in the pdf14 device
push without page_has_transparency if the call is done from
Postscript code. The PDF interpreter
always sets the page_has_transparency value before doing the
push so this should not be a problem with PDF.
Thanks to Chris Liddell for helping with this.
Diffstat (limited to 'devices/gdevx.c')
-rw-r--r-- | devices/gdevx.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/devices/gdevx.c b/devices/gdevx.c index cfde7543f..d439ca6de 100644 --- a/devices/gdevx.c +++ b/devices/gdevx.c @@ -36,8 +36,6 @@ /****** THIS IS USELESS. XGetImage DOES NOT GENERATE EXPOSURE EVENTS. ******/ #define GET_IMAGE_EXPOSURES 0 -/* GC descriptors */ -private_st_device_X(); /* Forward references */ static int x_copy_image(gx_device_X * xdev, const byte * base, int sourcex, @@ -240,6 +238,23 @@ const gx_device_X this_device = { \ } \ }; +static void +x_finalize(const gs_memory_t *cmem, void *vpdev) +{ + /* Do an actual close of the window. */ + gx_device_X *xdev = (gx_device_X *)vpdev; + + if (xdev->dpy) { + XCloseDisplay(xdev->dpy); + xdev->dpy = NULL; + } + gx_device_finalize(cmem, vpdev); +} + +gs_public_st_suffix_add1_final(st_device_X, gx_device_X, + "gx_device_X", device_x_enum_ptrs, device_x_reloc_ptrs, + x_finalize, st_device_bbox, buffer); + x_device(gs_x11_device, std_device_color_stype_body(gx_device_X, 0, "x11", &st_device_X, FAKE_RES * DEFAULT_WIDTH_10THS / 10, |