[Lazarus] App crash at TScreen.GetCustomFormsZOrdered
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Jun 27 11:55:48 CEST 2014
On Fri, 27 Jun 2014 11:33:53 +0200
Petr Hlozek <petr at ok2cqr.com> wrote:
> Hi,
>
> I have an Linux app, it has over 76k lines of code, 78 Forms and uses threads.
> After I close the app, it always crashes in
>
> function TScreen.GetCustomFormsZOrdered(Index: Integer): TCustomForm;
> begin
> Result := TCustomForm(FCustomFormsZOrdered[Index]);
> end;
>
> The index variable value is something like 42325 or so.
>
> I tried to debug and here is what I found out:
>
> It goes through all FormCloseQuesry, FormDestroy and
> DatamoduleDestory, then it goes to
> TApplication.DoBeforeFinalization and then into
> TScreen..GetCustomFormsZOrdered where it fails.
> I spent days trying to find out where could be the problem but didn't
> find anything. I'm lost. Do you have any idea where could be a
> problem, please? Thanks a lot!
Maybe some event uses an already freed object.
Set all references to nil, when freeing objects. For example in
TForm1.FormDestroy add Form1:=nil;
And compile with -gh.
Then you can run your program with environment variable
HEAPTRC=keepreleased
Mattias
More information about the Lazarus
mailing list