summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-07-18 03:02:46 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-07-18 03:02:46 +0000
commit1039639b6e79f17f14c04253b0f29ef6a4c1e2fe (patch)
tree4af6cd2d92a00a1cfd4615cf3a0d031af4cdd822 /Build
parent28e39c306555c3712bccbf8032c7ff0813de6c6a (diff)
Fix a bug that error cleanup routine can be called recursively (S. Hirata).
git-svn-id: svn://tug.org/texlive/trunk@55865 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog7
-rw-r--r--Build/source/texk/dvipdfm-x/dvipdfmx.c6
-rw-r--r--Build/source/texk/dvipdfm-x/pdfximage.c17
-rw-r--r--Build/source/texk/dvipdfm-x/pdfximage.h4
4 files changed, 32 insertions, 2 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 07e73ebceff..8821f2b2293 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,10 @@
+2020-07-18 Shunsaku Hirata <shunsaku.hirata74@gmail.com>
+
+ * dvipdfmx.c, pdfximage.[ch]: Don't call ordinary functions
+ such as pdf_close_images() which can call ERROR() in
+ error_cleanup(). This can result in a recursive call of
+ error_cleanup().
+
2020-07-11 Shunsaku Hirata <shunsaku.hirata74@gmail.com>
* pdfdev.c, pdfdoc.c, pdfdraw.[ch], pdfobj.[ch], spc_pdfm.c:
diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c
index 21b0e92725d..f67c7deb7dd 100644
--- a/Build/source/texk/dvipdfm-x/dvipdfmx.c
+++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c
@@ -870,7 +870,11 @@ system_default (void)
void
error_cleanup (void)
{
- pdf_close_images(); /* delete temporary files */
+ /* Fixed a stupid bug...
+ * Please don't put an ordinay function which may call ERROR() inside it.
+ * It may result in error cleanup routine being called recursively.
+ */
+ pdf_error_cleanup_cache(); /* delete temporary files */
pdf_error_cleanup();
if (pdf_filename) {
if (pdf_get_output_file()) {
diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c
index ef6282e80ad..be8e9a4da55 100644
--- a/Build/source/texk/dvipdfm-x/pdfximage.c
+++ b/Build/source/texk/dvipdfm-x/pdfximage.c
@@ -1056,3 +1056,20 @@ static int check_for_mp (FILE *image_file)
return ((try_count > 0) ? 1 : 0);
}
+
+/* ERROR() can't be used here otherwise the cleanup routine is recursively called. */
+#undef ERROR
+void
+pdf_error_cleanup_cache (void)
+{
+ struct ic_ *ic = &_ic;
+ int i;
+ pdf_ximage *I;
+
+ for (i = 0; i < ic->count; i++) {
+ I = &ic->ximages[i];
+ if (I->attr.tempfile) {
+ dpx_delete_temp_file(I->filename, false); /* temporary filename freed here */
+ }
+ }
+}
diff --git a/Build/source/texk/dvipdfm-x/pdfximage.h b/Build/source/texk/dvipdfm-x/pdfximage.h
index b174c44655f..fa29663ff70 100644
--- a/Build/source/texk/dvipdfm-x/pdfximage.h
+++ b/Build/source/texk/dvipdfm-x/pdfximage.h
@@ -1,6 +1,6 @@
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007-2020 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
@@ -102,4 +102,6 @@ pdf_ximage_set_attr (int xobj_id,
/* Migrated from pdfobj.h. Those are not PDF object related... */
+extern void pdf_error_cleanup_cache (void);
+
#endif /* _PDFXIMAGE_H_ */