[Lazarus] "Refactor" main menu item

Juha Manninen juha.manninen at phnet.fi
Sun Apr 11 19:48:40 CEST 2010


How to find this in the debuuger:

If you are on the crash, you have this stacktrace:
#0 INHERITSFROM(0xf0f0f0f0, 0xb8f888) at ..\inc\objpas.inc:529
#1 GETOBJECTPROP(0xf0f0f0f0, 0xb8f888, 0xb8f888) at 
..\objpas\typinfo.pp:1170
#2 ?? at :0
#3 ?? at :0
#4 GETCOLLECTIONS(0xf019308, 0xeb82c70, {Proc = {procedure (POINTER, 
TCOLLECTION)} 0xa20f02c, Self = 0xf019308}) at componenttreeview.pas:133
#5 WALK(0xf019308, 0xeb82c70) at componenttreeview.pas:174
#6 GETCHILDREN(0xeeba128, {Proc = {procedure (POINTER, TCOMPONENT)} 
0xa20f0c4, Self = 0xf019308}, 0xee1fa98) at tagraph.pas:988
#7 WALK(0xf019308, 0xeeba128) at componenttreeview.pas:182
#26 REMOVECOMPONENT(0xf0f0f0f0, 0xb8f888) at 
..\objpas\classes\compon.inc:618
....

** Select Frame 1:
----------
Function GetObjectProp(Instance: TObject; PropInfo : PPropInfo; 
MinClass: TClass): TObject;
begin
.....
   If (MinClass<>Nil) and (Result<>Nil) Then
     If Not Result.InheritsFrom(MinClass) then   // << current line 
<<<<<<<<<
       Result:=Nil;
end;
----------

Looking at Result:   TObject ($0DD5CD40) {  _vptr$TOBJECT = $f0f0f0f0}
=> this object was destroyed before

So what was it?
** Look at frame 4:
----------
procedure TComponentWalker.GetCollections(AComponent: TComponent; AProc: 
TGetCollectionProc);
....
begin
   PropCount := GetPropList(AComponent, PropList);
   try
     for i := 0 to PropCount - 1 do
       if (PropList^[i]^.PropType^.Kind = tkClass) then
       begin
         Obj := GetObjectProp(AComponent, PropList^[i], TCollection); << 
current line <<<<<<<<<<<<<<<
.....
-----------
We are looking at all published properties of AComponent

What is AComponent?
We may not have the Class, but we have the name: ChartTSummer => looking 
at the Form in the OI => it is a TLineSeries

using ctrl-F1 (evaluate/modify), we can evaluate:
   TLineSeries(AComponent)^

We see all the variables, some properties =>all we need is to search 
wich one has a value of $0DD5CD40 (pointing to the destroyed object)
=> its FMarks




On 11/04/2010 14:55, Martin wrote:
> On 11/04/2010 13:57, Alexander Klenin wrote:
>> Can anyone help me with http://bugs.freepascal.org/view.php?id=16035 ?
>> This code is so complicated, I can not understand what is going on.
>> It may be a bug in TAChart itself, but I do not see it either.
>> Now that the user was burned by the issue
>> (see http://bugs.freepascal.org/view.php?id=16254),
>> I think the priority has risen somewhat.
>>
> Not sure if it helps.
>
> but I found the following:
>
> When it crashes, it reads the Property  (and tries to perform an "is 
> TCollection" on it)
>   TLineSeries.Marks
>
> (in this case ChartTSummer)
>
> However it Seems that Marks has a dangling pointer to a destroyed object.
>
> I don't know where it may have been destroyed, nor if that should have 
> removed the pointer.
>
> Martin
>
>
>
> -- 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus





More information about the Lazarus mailing list