Crash on open document

PDF-XChange Editor SDK for Developers

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

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
vogelvision
User
Posts: 5
Joined: Tue Feb 09, 2016 6:01 pm

Crash on open document

Post by vogelvision »

I am using the AxPDFXEdit.AxPXV_Control on a form. When the form first opens I am able to open a document using OpenDocFromPath. However if I close the form and open the form again I get an exception thorwn when calling OpenDocFromPath:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Is there a certain way that the control needs to be disposed off or recreated in order to ensure consistent functionality?

Thank you!
vogelvision
User
Posts: 5
Joined: Tue Feb 09, 2016 6:01 pm

Re: Crash on open document

Post by vogelvision »

I've attached a sample project to demonstrate the bug.
You do not have the required permissions to view the files attached to this post.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Crash on open document

Post by Sasha - PDF-XChange »

Hello vogelvision,

For starters - we don't have the JIS components that you've included in your sample - we've updated them with common components.
Then we've tried to reproduce the problem - everything worked just fine.
Maybe you can provide a short video or GIF on how to reproduce it.
Also, maybe the problem is in your JIS components?
https://goo.gl/photos/cUdG9jHNiS1Ra7tw8

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vogelvision
User
Posts: 5
Joined: Tue Feb 09, 2016 6:01 pm

Re: Crash on open document

Post by vogelvision »

The problem happens on the second attempt to open the document. To reproduce the defect, open the new form then open a PDF, then close the new form, now click on the New Form button again and try to open a PDF. You should get an error on the second time you try to open the PDF from the New Form.

Please attach your working solution file so I may retest the bug too.
You do not have the required permissions to view the files attached to this post.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Crash on open document

Post by Sasha - PDF-XChange »

Hello vogelvision,

Attached the file.
And by the way - in my previous post there is a link to our google+ page with the GIF of how did I try to reproduce your steps (if you haven't seen it).

Cheers,
Alex
You do not have the required permissions to view the files attached to this post.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vogelvision
User
Posts: 5
Joined: Tue Feb 09, 2016 6:01 pm

Re: Crash on open document

Post by vogelvision »

Hi Alex,

Please attach your working Visual Studio solution so I may retest on my end.
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Crash on open document

Post by Sasha - PDF-XChange »

Hello vogelvision,

I've managed to reproduce the problem. The video sample you gave contained a file with dynamic XFA. Will investigate further.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Crash on open document

Post by Sasha - PDF-XChange »

Hello vogelvision,

Here's the solution.
I you're using control multiple times, you must create PXV_Inst ONE time globally and destroy it ONCE after the program end. The control will use the instance created automatically using class factories. So all of the controls that will be created will use ONE instance and there shouldn't be such problems.
So in your case the code should be like this:

Code: Select all

        PDFXEdit.PXV_Inst m_Inst;
        public Form1()
        {
		//In the form constructor we create and initialize instance ONCE per program flow
		m_Inst = new PDFXEdit.PXV_Inst();
		m_Inst.Init();
		InitializeComponent();
        }
        private void btnNewForm_Click(object sender, EventArgs e)
        {
		var form = new Form3();
		form.Show();
        }

	private void Form1_FormClosed(object sender, FormClosedEventArgs e)
	{
		//Do not forget to shutdown Instance that you've created
		m_Inst.Shutdown();
	}
HTH,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
vogelvision
User
Posts: 5
Joined: Tue Feb 09, 2016 6:01 pm

Re: Crash on open document

Post by vogelvision »

Thank you that fixed my problems.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19961
Joined: Mon Jan 12, 2009 8:07 am

Re: Crash on open document

Post by Stefan - PDF-XChange »

Glad to hear that vogelvision,

We will consider this case closed then!

Cheers,
Stefan