[ActiveX] Unhandled exceptions recreating AnnotationEditor

Discussions about annotation support.
User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

[ActiveX] Unhandled exceptions recreating AnnotationEditor

Post by AgfaDev » Thu Sep 19, 2013 1:08 pm

I'm using GdPicture v10.

Issue with AnnotationEditor using the ActiveX classes:

I have a picture viewer on one form.
The annotation Editor is started using a menu or button on this form.
It will create a second form, next to the viewer form. There the AnnotationEditor control is placed.

When closing this second screen and reopening it again I get an Error Message which is attached below:

Code: Select all

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceFrame.SetBorderSpace(COMRECT pborderwidths)
   at System.Windows.Forms.Control.ActiveXImpl.InPlaceActivate(Int32 verb)
   at System.Windows.Forms.Control.ActiveXImpl.OnFocus(Boolean focus)
   at System.Windows.Forms.Control.ChildGotFocus(Control child)
   at System.Windows.Forms.Control.ChildGotFocus(Control child)
   at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
   at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnGotFocus(EventArgs e)
   at System.Windows.Forms.Control.WmSetFocus(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.PropertyGridInternal.PropertyGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4984 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GdPicture.NET.10
    Assembly Version: 10.0.0.7
    Win32 Version: 10.0.0.7
    CodeBase: file:///C:/Program%20Files%20(x86)/GdPicture.NET%2010/Redist/COM%20Interop/GdPicture.NET.10.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4986 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4985 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4985 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Then the application becomes unstable and will crash after further use.


This is what I do in pseudocode

Code: Select all

Form1.axGdViewer

Form2.axAnnotationEditor
     On Create
          Form1.axGdViewer.GetObject( GdObject )
          axAnnotationEditor.LoadFromGdViewer( GdObject )
     On Close
          axAnnotationEditor.Dispose( )
So, this (pseudo) code works for the first time. The Editor is shown and populates the annotation attributes when clicking on
an annotation in the viewer.
But when this Form2 is closed and opened again, I get the error message as given.

Seems the object is not really destroyed/cleaned up internally.

What am I missing here? I tried not disposing, I tried to LoadFromGDViewer with an empty object but did not help.
There is no issue when the AnnotationEditor is placed on Form1, along with the viewer. But in that case, the control is not destroyed but
is always present.

Any help is appreciated.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Thu Sep 19, 2013 2:54 pm

Hello,

Could you reproduce the problem in a standalone app and share it with us? If there is confidential data you can send it through the helpdesk: http://orpalis.com

Kind regards,

Loïc

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Fri Sep 20, 2013 7:41 am

I created a prototype, which is standalone.

But it is programmed in Gupta Team Developer SqlWindows v6.1 (also known as Centura).
http://www.guptatechnologies.com/Produc ... fault.aspx

So, do you need a running application (exe and runtime) or do you need only the source (then you will have to have at least a trial version of this development environment) ?

When you want to see the sourcecode and run it, here the location to get the trial version (BEWARE you must use v6.1)
http://www.guptatechnologies.com/Servic ... loads.aspx

I attached the sourcecode in the ZIP.
Gupta_TD_GdPicturePrototype_Sources.zip
(1.02 MiB) Downloaded 155 times
When you need a running application, I attached the executable (Win32, no .NET) in a separate ZIP.
GdPicturePrototype_Application.zip
(931.14 KiB) Downloaded 145 times
To be able to run the exe, you need the Gupta TD runtime (like having to have a Java runtime to run Java apps).
It is free and can be downloaded from the downloads page mentioned above.

You need : Team Developer 6.1 SP3R Deployer | 90.9MB

After installation, copy the prototype executable in the same folder and run from Windows Explorer.
(the GdPicture v10 components must be installed and registered)

I hope you can find the issue. It seems that on the coding side nothing is wrong.


Prototype usage:
1) run application
2) open an image using the open folder button at the left side of the toolbar
3) Add annotation using the left most lower button
4) press the "annotation editor" button at the right
5) Editor is opened in a separate form, select annotation and see it works
6) Close the editor form
7) goto 4 to reopen the editor. Then the error message pops up

A more simple testcase is not to open an image and press "annotation editor".
Then close the editor and repeat starting it.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Fri Sep 20, 2013 10:52 am

Hi,
When you want to see the sourcecode and run it, here the location to get the trial version (BEWARE you must use v6.1)
What do I need to download exactly?
I can see:
Team Developer 6.1 SP3R .NET Test Drive | 502MB
Team Developer 6.1 SP3R Win32 Test Drive | 502MB <-- I guess this one??
Team Developer 6.1 SP3R Patch | 247MB
Team Developer 6.1 SP3R Deployer | 90.9MB
Team Developer 6.1 SP3R Books Online | 27.2MB
Team Developer 6.1 SP3R Samples | 81.2MB


Regards,

Loïc

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Fri Sep 20, 2013 11:15 am

For the development environment (loading source, compile, run, build) use:

Team Developer 6.1 SP3R Win32 Test Drive | 502MB
(trial version, 30 days with nag screen when starting the IDE) but fully functional.

(while installing, use custom install, and disable all connectivity and database (SqlBase) options, you do not need them)

For running the prototype exe, you only need the TD runtime which is:

Team Developer 6.1 SP3R Deployer | 90.9MB

(this runtime is free, no trial whatsoever)


When installing the Test Drive, you do not need to install the Deployer package. This is part of the dev. environment.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Fri Sep 20, 2013 11:47 am

OK, I've installed the environment, opened the project "GdPicture_Prototype.apt" and I can't find any way to run / debug the application. Any hint?
screenshot.jpg

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Fri Sep 20, 2013 12:02 pm

Oh bummer. I forgot to add the icon images in the archive.

Here you have the missing icons.
icons.zip
(6.95 KiB) Downloaded 135 times
Extract the icon folder into the same folder where the sources are saved.
(so the folder containing GdPicture_Prototype.apt should have a subfolder "icon" having the .ico files.)

Then you are able to run.

In the dev environment, go to menu "Project" and select item "Execute" (or press F7 to compile&run)

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Fri Sep 20, 2013 12:10 pm

thx I am good now. I will see if I can do something, this should take some hours...

Kind regards,

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Fri Sep 20, 2013 12:14 pm

Great. If you need any help, let me know.

First, I am eager to know if you can reproduce the issue (the unhandled exception errorbox).

(extra info: I created the prototype using GdPicture v9, and on that version also the same issue.
The prototype I send is ported to v10.
So I guess it is not specifically v10 related)

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Fri Sep 20, 2013 12:18 pm

First, I am eager to know if you can reproduce the issue (the unhandled exception errorbox).
Yes I was.
(extra info: I created the prototype using GdPicture v9, and on that version also the same issue.
So it is not specifically v10 related)
OK very useful, thanks.

Could you explain me how I could call the Dispose() method ThumbnailEx control on the unload event of the form that contain it? I still do not understand how this environment is handling code behind.

Regards,

Loïc

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Fri Sep 20, 2013 12:41 pm

The "unload" message when closing/destroy the form is coded under message actions of the form.

Code: Select all

Form Window: frmAnnotationEditor
     Message Actions
          On SAM_Close
               Call Close( )
          On SAM_Destroy
               Call Close( )
In the code, expand the form level and the message actions level to reveal the code.
(double click on the line to expand or collapse)

As you can see, there are two messages (events) coded: the SAM_Close and the SAM_Destroy.
The first (SAM_Close) is an intermediate message where you can abort closing when needed.
The second (SAM_Destroy) is the last message just before the form is destroyed.

(SAM messages are the default messages or events received on a visual object).
There are also WM messages which are purely windows based, like WM_Activate etc)

I tried both messages, there the function Close( ) is called.
This is a custom function defined/coded on the form. To see the contents of this function:

Go to

Code: Select all

Form Window: frmAnnotationEditor
     Functions
          Close
Expand this function and you will see :

Code: Select all

Function: Close
	Description:
	Returns
	Parameters
	Static Variables
	Local variables
	Actions
		Call axAnnoEditor.Dispose( )
		Call axAnnoEditor.Release( )
		Call SalDestroyWindow( axAnnoEditor )
		Call SalPause( 500 )
This is done:

1) Dispose method call on axAnnoEditor
2) Release the object. This is not needed normally, but to test I explicitly release the object.
This means that the COM interface is released. No link anymore to the component.
I added this to check if this solves the issue, but not.
3) Before the form destroys, I destroy the component on the form.
This is normally done automatically when the form destroys. But I wanted to test if this form destroy was too quick.
So this line is to destroy it first
4) the SalPause will wait 500 msecs (.5 secs) to let the component destroy and maybe cleanup better

When the function ends, the close and destroy will be executed.

So the extra lines after 2 are testcases I used to see if that solves the issue.
But normally, only a dispose would suffice (I think).

My feeling is that the axAnnoEditor is not really correctly destroyed. Maybe some internals have not cleaned up.
So when creating another instance, the previous one is still interfering.

I hope I explained.

To comment a line, press RMouse on the line and use "Comment items"
To uncomment, do the opposite

Functions starting with the text "Pal" are the internal functions of the language.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Sat Sep 21, 2013 2:10 pm

Hello,

OK the problem has been fixed for the next minor release that will be published within 2 and 5 days.

With best regards,

Loïc

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Sat Sep 21, 2013 2:30 pm

This is really great !!!

Thanks for this quick response.

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by Loïc » Mon Sep 23, 2013 6:13 pm

Hello,

The 10.0.8 has been release. Please let me know the result.

With best regards,

Loïc

User avatar
AgfaDev
Posts: 29
Joined: Thu Sep 12, 2013 7:48 am

Re: [ActiveX] Unhandled exceptions recreating AnnotationEdit

Post by AgfaDev » Tue Sep 24, 2013 9:02 am

Tomorrow I'm in the office, so then I can test it.
I will let you know asap.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest