[Lazarus] App crash at TScreen.GetCustomFormsZOrdered

Petr Hlozek petr at ok2cqr.com
Fri Jun 27 14:48:31 CEST 2014


Thank you for the help!

I added to all autocreated and used form into OnDestroy what you've
writen to me, in Project -> Option -> Debugging checked the -gh
option, Run -> Ru parameters in Environment tab added  HEAPTRC
variable.

After the crash, the callstack window shows

#0 HEAPTRC_TRACEFREEMEMSIZE$POINTER$QWORD$$QWORD at :0

When I click to View source, it jumps to the top of the heaptrc unit.

When I run the app from terminal with environment variable set, I got this:

An unhandled exception occurred at $000000000044139A :
EAccessViolation :
  $000000000044139A
  $00000000005DDD29

The same like before :(

Petr


2014-06-27 11:55 GMT+02:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
> 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
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



-- 
http://HamQTH.com/ok2cqr
http://ok2cqr.com
http://cqrlog.com
http://cqrtest.com




More information about the Lazarus mailing list