Crash into Winapi.GDIOBJ.Finalization

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
AROTechnologies
Newbie
Newbie
Posts: 4
Joined: Wed Apr 27, 2016 12:00 am

Crash into Winapi.GDIOBJ.Finalization

Post by AROTechnologies » Tue Jan 10, 2017 10:36 am

Hi,

When I close my application I have got a crash into Winapi.GDIOBJ.Finalization. I don't know why.
I have to precise than the form containing the graph is in a separated dll and I also link my application with the option "Link with runtime packages".

You can find an sample delphi 10.1 project to illustrated this in attachement.
I'm working with Steema TeeChart Pro VCL FMX 2016.19
Attachments
TeeChart_GDIPlus_exe_and_dll.zip
(151.66 KiB) Downloaded 483 times

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

Re: Crash into Winapi.GDIOBJ.Finalization

Post by Yeray » Tue Jan 10, 2017 2:46 pm

Hello,

Your application doesn't crash for me using TeeChart Pro v2016.19 and RAD 10.1 Berlin Update 2 in a Windows 10 x64 machine.
Should I do anything special with it?
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

AROTechnologies
Newbie
Newbie
Posts: 4
Joined: Wed Apr 27, 2016 12:00 am

Re: Crash into Winapi.GDIOBJ.Finalization

Post by AROTechnologies » Tue Jan 10, 2017 3:38 pm

Sorry I send you a bad project version.

Here is the good one.

Best regards,
Attachments
TeeChart_GDIPlus_exe_and_dll.zip
(156.86 KiB) Downloaded 479 times

AROTechnologies
Newbie
Newbie
Posts: 4
Joined: Wed Apr 27, 2016 12:00 am

Re: Crash into Winapi.GDIOBJ.Finalization

Post by AROTechnologies » Wed Jan 11, 2017 3:51 pm

When I change the charts renderer from GDI+ to GDI, the crash disappears.
What is the reason of that ?

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

Re: Crash into Winapi.GDIOBJ.Finalization

Post by Yeray » Thu Jan 12, 2017 10:38 am

Hello,

Take a look at this related thread and this article.

A couple of notes after investigating your example:

- DclTee924 is a design time package and shouldn't be in the "runtime packages" list.

- Even if both projects (exe and dll) have "runtime packages" with the same package (ie Tee924), this doesn't seem to work fine. The referenced package isn't listed under "Project->Information for Chart_EXE".
This can be solved adding "VCLTee.Chart" in the uses clause of the Unit_EXE.pas.

- Finalization in WinAPI.GDIPObj.pas is called twice (one for the library and one for the exe). The second time causes the error because it is already shut down.
We've observed that, if you comment the GdiplusShutdown call, the error stops appearing.
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

AROTechnologies
Newbie
Newbie
Posts: 4
Joined: Wed Apr 27, 2016 12:00 am

Re: Crash into Winapi.GDIOBJ.Finalization

Post by AROTechnologies » Thu Jan 12, 2017 12:23 pm

Hello,

Thanks for your answer.
Just a few questions. Which are the packages I have to reference in the runtime packages?
Why did you say that Finalization in WinAPI.GDIPObj.pas is called twice (one for the library and one for the exe)?
I see it only once in the exe.

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

Re: Crash into Winapi.GDIOBJ.Finalization

Post by Yeray » Fri Jan 13, 2017 8:30 am

Hello,
AROTechnologies wrote: Which are the packages I have to reference in the runtime packages?
Take a look at this explanation:
http://stackoverflow.com/questions/2303 ... e-packages

I've moved the Chart_EXE.exe and the Chart_DLL.dll to a clean Windows 10 virtual machine. Executing the exe fails with missing rtl240.bpl, then Tee924.bpl,... Finally, the minimum files I had to distribute were:
Chart_DLL.dll
Chart_EXE.exe
rtl240.bpl
Tee924.bpl
vcl240.bpl
vclimg240.bpl
AROTechnologies wrote:Why did you say that Finalization in WinAPI.GDIPObj.pas is called twice (one for the library and one for the exe)?
I see it only once in the exe.
We saw it debugging, placing a breakpoint at the Finalization part in WinAPI.GDIPObj.pas. The first time passing IsLibrary=True, the second time IsLibrary=False and it crashes because it has been already shut down.
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

Post Reply