summaryrefslogtreecommitdiff
path: root/base/gdevdflt.c
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2021-01-28 08:20:57 -0800
committerRay Johnston <ray.johnston@artifex.com>2021-03-03 13:13:13 -0800
commit1255220cedad4cb551e6593c3af2f8c80f8df629 (patch)
tree6b893df5012ff1a5e39a0be65523ac22b401a2a5 /base/gdevdflt.c
parent5e65dc7776fa98a3640602257f36f229111becb4 (diff)
downloadghostpdl-1255220cedad4cb551e6593c3af2f8c80f8df629.tar.gz
NupControl improvements to prevent save/restore problems.
The NupControl string needs to be a reference counted to work with save/ restore, and when the parameter is changed the new value needs to be propagated to children devices. The structure containing the string is adpated (simplified slightly) from the PageList implementation. Note that the parents and children references must be included in the ref_count when the NupControl structure is updated (example if 'epo' is installed, when it uninstalls itself, cannot free the the structure when it does rc_decrement). Minor comment change to devices/gdevbit.c to change NupList to NupControl.
Diffstat (limited to 'base/gdevdflt.c')
-rw-r--r--base/gdevdflt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/base/gdevdflt.c b/base/gdevdflt.c
index 310b716c5..5267b7589 100644
--- a/base/gdevdflt.c
+++ b/base/gdevdflt.c
@@ -1431,6 +1431,8 @@ int gx_device_subclass(gx_device *dev_to_subclass, gx_device *new_prototype, uns
rc_increment(dev_to_subclass->icc_struct);
if (dev_to_subclass->PageList)
rc_increment(dev_to_subclass->PageList);
+ if (dev_to_subclass->NupControl)
+ rc_increment(dev_to_subclass->NupControl);
/* In case the new device we're creating has already been initialised, copy
* its additional data.
@@ -1561,6 +1563,8 @@ int gx_device_unsubclass(gx_device *dev)
rc_decrement(child->icc_struct, "gx_unsubclass_device, icc_struct");
if (child->PageList)
rc_decrement(child->PageList, "gx_unsubclass_device, PageList");
+ if (child->NupControl)
+ rc_decrement(child->NupControl, "gx_unsubclass_device, NupControl");
/* we cannot afford to free the child device if its stype is not dynamic because
* we can't 'null' the finalise routine, and we cannot permit the device to be finalised
* because we have copied it up one level, not discarded it.