From fae21f1668d2b44b18b84cf0923a1d5f3008a696 Mon Sep 17 00:00:00 2001 From: Ken Sharp Date: Tue, 4 Dec 2018 21:31:31 +0000 Subject: subclassing devices - fix put_image method The subclassing devices need to change the 'memory device' parameter to be the child device, when its the same as the subclassing device. Otherwise we end up trying to access the child device's memory pointers in the subclassing device, which may not contain valid copies of those pointers. diff --git a/base/gdevsclass.c b/base/gdevsclass.c index d9c85d2e4..51092585a 100644 --- a/base/gdevsclass.c +++ b/base/gdevsclass.c @@ -797,7 +797,10 @@ int default_subclass_put_image(gx_device *dev, gx_device *mdev, const byte **buf int alpha_plane_index, int tag_plane_index) { if (dev->child) - return dev_proc(dev->child, put_image)(dev->child, mdev, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index); + if (dev == mdev) + return dev_proc(dev->child, put_image)(dev->child, dev->child, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index); + else + return dev_proc(dev->child, put_image)(dev->child, mdev, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index); return 0; }