[Lazarus] Help debugging

Kjow antispammoni at gmail.com
Wed Jan 11 16:01:16 CET 2012


Hi all,

I have a "random" crash that I can't debug on my program.

I have a class that contains some other classes, variables, etc. On
some point of execution the program creates the object class and in an
other point it frees this object.

I need to do this some times in the "timeline", e.g.:

On class:
"
procedure TBody.InitOtherThings;
...
obj2:= TSomeThing.create(nil);
obj2.moveto(obj1);
...
var2:= var1;
...
"

On "timeline":
"
...
body:= TBody.create;
body.obj1:= Form1.obj1; //I need something like this
body.var1:= 123;
body.InitOtherThings;
...
"

On "timeline+2":
"
...
if assigned(body) Then
 body.free;
"


On "timeline+3":
"
...
body:= TBody.create;
body.obj1:= Form1.obj1; //I need something like this
body.var1:= 123;
body.InitOtherThings;
...
"

On "timeline+4":
"
...
if assigned(body) Then
 body.free;
"

Of course, I'm sorry about this example... I wrote it as stupid
example, without copy anything of original code (too complex).

Anyway, everything works right, but after sometimes I create/free, I
get a "SYSTEM_TOBJECT_$_FREE (18)" error, but I can't get the row in
my source code where the error is generated. In attachment the window
with the error.

Thank you in advance.
Kjow

PS generally the crash happens after the third time I free the object.
(Sometime it never happens)




More information about the Lazarus mailing list