fb69d56
From 90fd0c7ca3efc1ddff64a86f4104b13b3ac969eb Mon Sep 17 00:00:00 2001
fb69d56
From: Michael Vrhel <michael.vrhel@artifex.com>
fb69d56
Date: Thu, 29 Dec 2016 14:00:21 -0800
fb69d56
Subject: [PATCH] Bug 697456.  Dont create new ctx when pdf14 device reenabled
fb69d56
fb69d56
This bug had yet another weird case where the user created a
fb69d56
file that pushed the pdf14 device twice.  We were in that case,
fb69d56
creating a new ctx and blowing away the original one with out
fb69d56
proper clean up.  To avoid, only create a new one when we need it.
fb69d56
---
fb69d56
 base/gdevp14.c | 6 ++++--
fb69d56
 1 file changed, 4 insertions(+), 2 deletions(-)
fb69d56
fb69d56
diff --git a/base/gdevp14.c b/base/gdevp14.c
fb69d56
index fd56ec9..f19318e 100644
fb69d56
--- a/base/gdevp14.c
fb69d56
+++ b/base/gdevp14.c
fb69d56
@@ -1669,8 +1669,10 @@ pdf14_open(gx_device *dev)
fb69d56
     rect.p.y = 0;
fb69d56
     rect.q.x = dev->width;
fb69d56
     rect.q.y = dev->height;
fb69d56
-    pdev->ctx = pdf14_ctx_new(&rect, dev->color_info.num_components,
fb69d56
-        pdev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE, dev);
fb69d56
+    /* If we are reenabling the device dont create a new ctx. Bug 697456 */
fb69d56
+    if (pdev->ctx == NULL)
fb69d56
+        pdev->ctx = pdf14_ctx_new(&rect, dev->color_info.num_components,
fb69d56
+            pdev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE, dev);
fb69d56
     if (pdev->ctx == NULL)
fb69d56
         return_error(gs_error_VMerror);
fb69d56
     pdev->free_devicen = true;
fb69d56
-- 
fb69d56
2.9.3
fb69d56