diff options
Diffstat (limited to 'Build/source/texk/dvipdfm-x/pdfximage.c')
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfximage.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c index b3b0d5ccd0a..0265ef8e5ad 100644 --- a/Build/source/texk/dvipdfm-x/pdfximage.c +++ b/Build/source/texk/dvipdfm-x/pdfximage.c @@ -466,8 +466,17 @@ pdf_ximage_load_image (const char *ident, const char *filename, load_options opt WARN("Try again with the distiller."); format = IMAGE_TYPE_EPS; rewind(fp); - } else + } else { + /* Workaround for the problem reported. + * mps_include_page() above doesn't set I->filename... + */ + I = &ic->ximages[id]; + if (!I->filename) { + I->filename = NEW(strlen(filename)+1, char); + strcpy(I->filename, filename); + } break; + } default: id = load_image(ident, filename, fullname, format, fp, options); break; @@ -602,12 +611,18 @@ pdf_ximage_set_image (pdf_ximage *I, void *image_info, pdf_obj *resource) pdf_merge_dict(dict, I->attr.dict); if (I->ident) { - pdf_names_add_object(global_names, I->ident, strlen(I->ident), pdf_link_obj(resource)); + int error; + + error = pdf_names_add_object(global_names, I->ident, strlen(I->ident), pdf_link_obj(resource)); if (I->reference) pdf_release_obj(I->reference); - /* Need to create object reference before closing it */ - I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident)); - pdf_names_close_object(global_names, I->ident, strlen(I->ident)); + if (error) { + I->reference = pdf_ref_obj(resource); + } else { + /* Need to create object reference before closing it */ + I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident)); + pdf_names_close_object(global_names, I->ident, strlen(I->ident)); + } I->reserved = 0; } else { I->reference = pdf_ref_obj(resource); @@ -642,12 +657,18 @@ pdf_ximage_set_form (pdf_ximage *I, void *form_info, pdf_obj *resource) I->attr.bbox.ury = max4(p1.y, p2.y, p3.y, p4.y); if (I->ident) { - pdf_names_add_object(global_names, I->ident, strlen(I->ident), pdf_link_obj(resource)); + int error; + + error = pdf_names_add_object(global_names, I->ident, strlen(I->ident), pdf_link_obj(resource)); if (I->reference) pdf_release_obj(I->reference); - /* Need to create object reference before closing it */ - I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident)); - pdf_names_close_object(global_names, I->ident, strlen(I->ident)); + if (error) { + I->reference = pdf_ref_obj(resource); + } else { + /* Need to create object reference before closing it */ + I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident)); + pdf_names_close_object(global_names, I->ident, strlen(I->ident)); + } I->reserved = 0; } else { I->reference = pdf_ref_obj(resource); |