Thread create in dll causes delayed access violation.
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
I use: FPC version 2.0.0 [2005/05/08] and Delphi 6 with RTL Update 3 and General Update 2
When a thread is created in a dll, in suspended mode or otherwise, a delayed access violation occurs that only shows up upon program termination. (Access violation at address 1000AAC0. Read of address 1000AAC0.) The address does of course vary from program to program.
This error has one more prerequisite: the calling program (exe) must have a delphi VCL TForm or descendant VISIBLE (note: inivisible forms dont cause the error). And this form must be visible during the FREELIBRARY call, if the form is FREED before the call no errors are caused.
Also note: when the same DLL is compiled with Delphi everything works fine.
I do not think this is a bug in Delphi as the TForm is too widely used and the bug would be present in almost every Delphi program.
This is getting more confusing but, importantly: if FreeLibrary is called AFTER the form has been freed then there is no error, THEREFORE, the bug must be in the DLL's RTL (i think) finalization code.
I could just wait until right at the end of my program to call all "FreeLibrary"s but that just wouldnt be cool ;)
There are two source files included.
Additional information:
Reporter: Misha Strong
EMail: skiy at actionpos dot co dot za
Mantis conversion info:
- Mantis ID: 6355
- OS: Win32