diff options
-rw-r--r-- | psi/imain.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/psi/imain.c b/psi/imain.c index 2fe15465e..138bfc82b 100644 --- a/psi/imain.c +++ b/psi/imain.c @@ -936,6 +936,16 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code) i_ctx_p = minst->i_ctx_p; /* interp_reclaim could change it. */ } + if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL && + gx_device_is_null(i_ctx_p->pgs->device)) { + /* if the job replaced the device with the nulldevice, we we need to grestore + away that device, so the block below can properly dispense + with the default device. + */ + int code = gs_grestoreall(i_ctx_p->pgs); + if (code < 0) return_error(gs_error_Fatal); + } + if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL) { gx_device *pdev = i_ctx_p->pgs->device; const char * dname = pdev->dname; |