summaryrefslogtreecommitdiff
path: root/pdf/pdf_form.c
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2012-09-06 15:15:22 +0100
committerPaul Gardiner <paulg.artifex@glidos.net>2012-09-18 14:59:49 +0100
commitc06c3f6183eb6e7955749c060abe99e0b91ea1f7 (patch)
tree841d7fb48faa77628fb1d4dfe79e3830136d3bff /pdf/pdf_form.c
parent33bfa9165dacaabd008144aa96a61612fea97c6b (diff)
downloadmupdf-c06c3f6183eb6e7955749c060abe99e0b91ea1f7.tar.xz
Forms: improve cpp/c interface regarding exceptions
Three alterations: We were previously being careful to avoid throwing exceptions in the DOM-implementation callbacks because these were being called directly from C++. This commit adds three veneers that turn exceptions into warnings, hence allowing the callbacks to be written in usual mupdf style. Protect the "field" callbacks from executing with a NULL field. Ensure that the event object is set up before executing A actions
Diffstat (limited to 'pdf/pdf_form.c')
-rw-r--r--pdf/pdf_form.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c
index 2fb8114c..76e28058 100644
--- a/pdf/pdf_form.c
+++ b/pdf/pdf_form.c
@@ -1737,9 +1737,13 @@ void pdf_update_appearance(pdf_document *doc, pdf_obj *obj)
static void execute_action_chain(pdf_document *doc, pdf_obj *obj)
{
- pdf_obj *a;
+ pdf_obj *a = pdf_dict_gets(obj, "A");
+ pdf_js_event e;
+
+ e.target = obj;
+ e.value = "";
+ pdf_js_setup_event(doc->js, &e);
- a = pdf_dict_gets(obj, "A");
while (a)
{
execute_action(doc, obj, a);