Page 1 of 1
Crash into Winapi.GDIOBJ.Finalization
Posted: Tue Jan 10, 2017 10:36 am
by 16478162
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
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Tue Jan 10, 2017 2:46 pm
by yeray
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?
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Tue Jan 10, 2017 3:38 pm
by 16478162
Sorry I send you a bad project version.
Here is the good one.
Best regards,
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Wed Jan 11, 2017 3:51 pm
by 16478162
When I change the charts renderer from GDI+ to GDI, the crash disappears.
What is the reason of that ?
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Thu Jan 12, 2017 10:38 am
by yeray
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.
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Thu Jan 12, 2017 12:23 pm
by 16478162
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.
Re: Crash into Winapi.GDIOBJ.Finalization
Posted: Fri Jan 13, 2017 8:30 am
by yeray
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.