CloseAllDocuments(0) crash

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

entropics
User
Posts: 10
Joined: Wed Jul 02, 2014 7:00 am

CloseAllDocuments(0) crash

Post by entropics »

Hello,

We are using the ActiveX SDK With Delphi.

If the first command we issue is CloseAllDocuments(0) then we get an access violation.

Any idea ?

Best regards
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: CloseAllDocuments(0) crash

Post by Vasyl - PDF-XChange »

Hi, entropics.

We cannot reproduce this. Can you send to us the simple example with reproducible issue?

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
entropics
User
Posts: 10
Joined: Wed Jul 02, 2014 7:00 am

Re: CloseAllDocuments(0) crash

Post by entropics »

Hello,

Here is a very simple program to reproduce it (in Delphi XE6)

Best regards
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: CloseAllDocuments(0) crash

Post by Stefan - PDF-XChange »

Thanks entropics,

I've passed it to a colleague from the dev team that will take a look.

Regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: CloseAllDocuments(0) crash

Post by Vasyl - PDF-XChange »

Hi, entropics.
If the first command we issue is CloseAllDocuments(0) then we get an access violation.
Reason of that: you called the CloseAllDocuments() when no one document is opened. In this case this function returns the error code "HAVE NO DOCUMENTS". Your COM-stub generates exception on that, in standard way. To prevent this exception use:

Code: Select all

try
     CloseAllDocuments(0);
exept
     { on ex : EOleException do
        ShowErrorMessage(ex.ErrorCode); }
end;
- for more examples look to our Viewer ActiveX Delphi Examples (<X>:\Program Files\Tracker Software\PDF-XChange Viewer SDK\Examples\DelphiExamples)...

HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
entropics
User
Posts: 10
Joined: Wed Jul 02, 2014 7:00 am

Re: CloseAllDocuments(0) crash

Post by entropics »

Thank you very much for your answer,

But i'm a little bit suprised that if you call CloseAllDocuments and there is no opened documents, it fails. I would have expected the function to succeed.

Best regards
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: CloseAllDocuments(0) crash

Post by Stefan - PDF-XChange »

Hello entropics,

It does not "fail" - it returns an exception - which was not handled correctly before.
If there are no opened documents - Close All can not "perform" it's operation so that it can exit with a success code and gives you the exception so that you are aware there were no files closed.

Regards,
Stefan