--- devices/gdevijs.c.orig 2015-10-05 10:21:11.000000000 +0200 +++ devices/gdevijs.c 2015-10-12 10:17:53.000000000 +0200 @@ -827,6 +827,10 @@ gsijs_open(gx_device *dev) if (code < 0) return code; + while (dev->child) + dev = dev->child; + ijsdev = (gx_device_ijs *)dev; + if (use_outputfd) { /* Note: dup() may not be portable to all interesting IJS platforms. In that case, this branch should be #ifdef'ed out. --- base/gdevdflt.c.orig 2015-10-05 10:21:11.000000000 +0200 +++ base/gdevdflt.c 2015-10-12 10:21:11.000000000 +0200 @@ -17,6 +17,8 @@ #include "math_.h" #include "memory_.h" #include "gx.h" +#include "gsstruct.h" +#include "gxobj.h" #include "gserrors.h" #include "gsropt.h" #include "gxcomp.h" @@ -1294,6 +1296,11 @@ int gx_device_subclass(gx_device *dev_to ptr1 = ((char *)new_prototype) + sizeof(gx_device); memcpy(ptr, ptr1, new_prototype->params_size - sizeof(gx_device)); + /* We have to patch up the "type" parameters that the memory manage/garbage + * collector will use, as well. + */ + (((obj_header_t *)dev_to_subclass) - 1)->o_type = new_prototype->stype; + /* If the original device's stype structure was dynamically allocated, we need * to 'fixup' the contents, it's procs need to point to the new device's procs * for instance. --- base/lib.mak.orig 2015-10-05 10:21:11.000000000 +0200 +++ base/lib.mak 2015-10-12 10:22:51.000000000 +0200 @@ -1210,7 +1210,7 @@ $(GLOBJ)gdevdsha.$(OBJ) : $(GLSRC)gdevds $(GLOBJ)gdevdflt.$(OBJ) : $(GLSRC)gdevdflt.c $(AK) $(gx_h)\ $(gserrors_h) $(gsropt_h) $(gxcomp_h) $(gxdevice_h) $(gxdevsop_h) $(math__h)\ - $(MAKEDIRS) + $(gsstruct_h) $(gxobj_h) $(MAKEDIRS) $(GLCC) $(GLO_)gdevdflt.$(OBJ) $(C_) $(GLSRC)gdevdflt.c $(GLOBJ)gdevdgbr.$(OBJ) : $(GLSRC)gdevdgbr.c $(AK) $(gx_h)\