PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

> I use the skeleton STARTER application furnished with the 5.0 
> SDK with 
> just the method REPLACE in the PluginImportReplaceAndRegister 
> procedure, 
> ie :
> 
> myAVDocOpenCallback =
> ASCallbackCreateReplacement(AVDocOpenFromFileWithParamsSEL
>          , &monAVDocWillOpen);
> REPLACE(gAcroViewHFT
>          , AVDocOpenFromFileWithParamsSEL
>          , myAVDocOpenCallback);
> 
> I free my callback in the PluginUnload procedure :
> 
> ASCallbackDestroy(myAVDocOpenCallback);

I don't like the look of that. You are destroying a callback that
is still active in an HFT. I know it's cleanup time and you might
think this is safe. But consider: another plug-in might be about
to clean up, and it might open a file as part of its processing.

It's easy to say "you should restore the original value" but that
has its dangers. What if another plug-in replaced it after you?

I don't have an ideal solution, but given that Acrobat doesn't 
currently support dynamic plug-in unloading, I would recommend
not destroying it.  Also, be sure that your callback will not
fail if it is called AFTER your plug-in has otherwise quit. Store
the previous address in a static variable, and have a static
"Finished" variable; if Finished is true (set by Unload) just
call the previous method.

I think if Adobe do ever support dynamic unloading they will
need a neater method of replacing HFT entries.

You should also bear in mind in the processing for your
AVDocOpenWithParams intercept that the length of the parameter
block may now be larger than you expect. Be sure you handle
this correctly, and pass the entire original block through
to the next level, not just the length you think it should
have.

Aandi

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to