Application process is not terminated

TeeChart for ActiveX, COM and ASP
jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Application process is not terminated

Post by jhameenniemi » Fri May 31, 2013 11:24 am

TeeChart V. 2013.0.1.0, C++ MFC application. TeeChart component is a member of a CView derived class and chart is created using .Create API function:

Code: Select all

.h
CTChart m_wndChart;

.cpp
m_wndChart.Create(_T(""), WS_CHILD|WS_VISIBLE, chartRect, this, ID_CHART)
When application is closed the application process is not terminated IF TeeChart component has been loaded into process. IF TeeChart component has NOT been loaded into process (i.e. no chart windows have been created or TeeChart component file has been renamed so that it cannot be loaded) application process is terminated normally. It does not matter if there are open chart windows or if all chart windows have been closed before closing the application.

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Application process is not terminated

Post by Yeray » Fri May 31, 2013 3:03 pm

Hi,

Can you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Tue Jun 04, 2013 9:15 am

Unfortunately we cannot reproduce this problem using a simple test program. Here is a call stack from our application:
Call stack.PNG
Call stack.PNG (303.72 KiB) Viewed 36540 times
As we do not have symbols for TeeChart we cannot look any further to the problem ourselves. If you have any suggestions how to proceed feel free to contact privately by email as we cannot provide any more specific information in a public forum.

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Tue Jun 04, 2013 11:33 am

OK. We found the reason for the deadlock. TeeChart calls GdiplusStartup and GdiPlusShutdown which it should not do. Here is a Remark section from MSDN for GdiplusStartup:
Remarks

Do not call GdiplusStartup or GdiplusShutdown in DllMain or in any function that is called by DllMain. If you want to create a DLL that uses GDI+, you should use one of the following techniques to initialize GDI+:
- Require your clients to call GdiplusStartup before they call the functions in your DLL and to call GdiplusShutdown when they have finished using your DLL.
- Export your own startup function that calls GdiplusStartup and your own shutdown function that calls GdiplusShutdown. Require your clients to call your startup function before they call other functions in your DLL and to call your shutdown function when they have finished using your DLL.
- Call GdiplusStartup and GdiplusShutdown in each of your functions that make GDI+ calls.
An example program included. If you comment out GdiplusShutdown call from MainFrm.cpp line 69 process is terminated correctly otherwise it is not terminated. The correct solution is that TeeChart does not call these functions but implements some of the mechanisms outlined in the remarks section above.
Attachments
TeeTest.zip
(78.36 KiB) Downloaded 1598 times

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Application process is not terminated

Post by Yeray » Tue Jun 04, 2013 2:28 pm

Hello,

I've reproduced the problem.
I see you are customer since TeeChart ActiveX v6, isn't it? So assume it works fine in older versions. Have you identified the last version where it worked fine?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Wed Jun 05, 2013 6:16 am

TeeChart ActiveX v 8. 2012.0.0.9 does not work as well as 2013.0.1.0. We have not used anything between v 8 and 2012.0.0.9.

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Wed Jun 05, 2013 6:20 am

Any chance you get this fixed fast? We have a deadline approaching and need to rollback to v 8 if this is not fixed in a week or two. Thanks.

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Application process is not terminated

Post by Yeray » Wed Jun 05, 2013 10:54 am

Hello Tero,

We are currently investigating what change in v2013.0.1.0 could affect this. It seems to work fine in v2012.0.0.9.
TeeChart moved the default Canvas from GDI to GDI+ in this version. So you could try to disable GDI+ to see if it works better.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Application process is not terminated

Post by Yeray » Thu Jun 06, 2013 7:42 am

Update with some information the customer gave us through mail (tell us if you don't want to make it public here):
jhameenniemi wrote:actually we do not use GDI+ rendering because TeeChart 2013.0.1.0. has some rendering bugs if using GDI+ so we switched back to GDI rendering:

Code: Select all

m_wndChart.GetAspect().GetGDIPlus().SetActive(FALSE); // disable GDI+ rendering (defaults to enabled in V.2013)
so no, it does not solve anything. Our products use GDI+ and some GDI+ calls are made in .dll:s so we need to call GdiplusStartup in application’s InitInstance() and GdiplusShutdown in ExitInstance() because we know for sure that some of them do not call these functions before using GDI+ calls.
We are investigating what's happening here (TA05016588).
However, I'm afraid I can't tell you if this is going to be fixed imminently or in how many time.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Thu Jun 06, 2013 8:23 am

Yeray,

you are correct. 2012.0.0.9 works OK. I did not realize that 2012.0.0.9 and 2013.0.1.0 cannot co-exist in the same machine which I think was a natural assumption because file names are different (TeeChart2012.ocx vs. TeeChart2013.ocx).

Yeray
Site Admin
Site Admin
Posts: 9617
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Application process is not terminated

Post by Yeray » Thu Jun 06, 2013 1:34 pm

Hi,

Right, both versions use the same GUID so it's easier to upgrade your applications.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Marc
Site Admin
Site Admin
Posts: 1274
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Application process is not terminated

Post by Marc » Tue Jun 11, 2013 9:26 am

Hello,

Thanks for the detailed problem submission and observations about GDIPlusStartup/Shutdown. With the change to GDI+ as default rendering mode we had not sufficiently envisaged that TeeChart might be used in this way in a container using GDIPlus. Looking to resolve the problem, we need a solution that permits us to maintain TeeChart's GDI+ render as default render mode and allows a developer to override it, disabling GDI+ and shutting it down without consequence for the container application....

Fortunately nesting GDIPlusStartup/Shutdown is a technically workable option and tests we've made to follow nested GdiPlusToken values confirms that to be the case. Our tests have also confirmed that if an unload is made out of nest sequence a problem can occur. That seems to have been the case in the version of TeeChart AX that you have been using.

We are making a test version available that offers nestable shutdown of TeeChart's GDIPlus. We hope that will be a useable option for you. Your feedback will be appreciated.

With thanks.
Regards,
Marc Meumann
Steema Support

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Thu Nov 14, 2013 8:07 am

Any plans to make this fix permanent and included in maintenance release builds? It is a pita to ask special .ocx version for every maintenance release.

Marc
Site Admin
Site Admin
Posts: 1274
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Application process is not terminated

Post by Marc » Thu Nov 14, 2013 8:23 am

Hello,

Yes, we fully intend that the GDIShutdown feature form a part of the core product. It was to be included in the last build but due to a technical hitch it has been postponed for the next build that we expect to make available imminently. Apologies for the inconvenience caused.

Regards,
Marc Meumann
Steema Support

jhameenniemi
Newbie
Newbie
Posts: 17
Joined: Mon Apr 15, 2013 12:00 am

Re: Application process is not terminated

Post by jhameenniemi » Mon Sep 29, 2014 7:09 am

Downloaded the lastest release and surprise surprise GDI+ intialization bug is once again back. Please, fix it. Thank you.

Post Reply