------------------------------------------------------------------------ r3689 | hhenkel | 2010-05-16 13:34:25 +0200 (Sun, 16 May 2010) | 12 lines Changed paths: M /trunk/source/texk/web2c/luatexdir/image/epdf.h M /trunk/source/texk/web2c/luatexdir/image/pdftoepdf.cc M /trunk/source/texk/web2c/luatexdir/lua/lepdflib.cc A check was missing, if a PDFDoc object from epdf.open() had not been deleted meanwhile, so that all derived Lua variables (which are pointers into the XPDF structure) would point to illegal addresses, causing a segfault. The cleanest fix may be to use the luaL_ref() and luaL_unref() mechanism with __gc, but that gets ugly, if the number of arguments for a Lua accessor function differs; it would need to keep all references with the variable. Instead (as a try, it may change) now a counter is used, which increments always if anything happened to the PDFDoc (closing, re-opening). By this counter it is assured that the PDFDoc object is the same as long as any derived variable is used; else a Lua error is generated. It't a bit tedious, bloating the code, but it seems to be fast. ------------------------------------------------------------------------