Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-03

Help to find cause of crash in IDE after revision 19044

15 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luiz Americo Pereira Camara

Starting from revision 19044, when i put a TVirtualStringTree control in a form the IDE crashes (see attached log). I could not reproduce with other controls and i'm not sure if the problem is in the changes introduced in 19044 or if just revealed a TVirtualStringTree bug.

The VTV code can be obtained from:
https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/virtualtreeview-new It requires LCLExtension package:
https://luipack.googlecode.com/svn/trunk/lclextensions

Any help is appreciated.

Luiz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed... Name: test2.log
Url: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090321/f81a5e38/attachment.pl

Reply by email

Alexander Klenin
to Luiz Americo Pereira Camara

2009/3/22 Luiz Americo Pereira Camara :

Show quoted text 12 lines
Starting from revision 19044, when i put a TVirtualStringTree control in a form the IDE crashes (see attached log). I could not reproduce with other controls and i'm not sure if the problem is in the changes introduced in 19044 or if just revealed a TVirtualStringTree bug. The VTV code can be obtained from: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/virtualtreeview-new It requires LCLExtension package: https://luipack.googlecode.com/svn/trunk/lclextensions Any help is appreciated.

This code was introduced recently by me. This is either my bug or yours, depending on how we decide ;-)

Show quoted text 8 lines
?$00641C2A ?TLISTPROPERTYEDITOR__GETELEMENTCOUNT, ?line 3394 of propedits.pp ?$0064218A ?TLISTPROPERTYEDITOR__DOSAVEELEMENTS, ?line 3501 of propedits.pp ?$00641EBD ?TLISTPROPERTYEDITOR__SAVEELEMENTS, ?line 3436 of propedits.pp ?$006426D1 ?TLISTPROPERTYEDITOR__INITIALIZE, ?line 3608 of propedits.pp ?$0064AEEC ?REC, ?line 6817 of propedits.pp ?$0064ACE2 ?ISINTERESTING, ?line 6832 of propedits.pp ?$0062979D ?TOICUSTOMPROPERTYGRID__EDITORFILTER, ?line 2169 of objectinspector.pp

This code does:

      ed := edClass.Create(nil, 1);
      try
        ed.SetPropEntry(0, A.GetComponent(0), propList^[i]);
        ed.Initialize;

note the "nil" hook parameter. So you have to do one of the following:

1) apply the attached patch
(but note that the hook it will pass might be not the right one -- I am not sure)
2) check for nil hook in your Initialize function
3) explain to me how to obtain the correct hook ;-)

If (1) helps, please apply the patch to Lazarus, if you have commit rights.

Alexander S. Klenin -------------- next part -------------- A non-text attachment was scrubbed... Name: oi_prop_hook.patch Type: text/x-diff Size: 550 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090322/5d1c7e16/attachment.bin

Reply by email

Alexander Klenin
to Alexander Klenin

As a general design note, I think that PropertyEditor.GetAttributes function should be split into "static" and "dynamic" parts, where "static" part supplies type-specific attributes, and "dynamic" -- value-specific ones.

Alexander S. Klenin

Reply by email

Alexander Klenin
to Alexander Klenin: 2009/3/22 Luiz Americo Pereira Camara : This code was introduced recently by me. This is…
Alexander Klenin wrote
1) apply the attached patch

I somehow managed to save incorrect patch. Please use this version instead.

Alexander S. Klenin -------------- next part -------------- A non-text attachment was scrubbed... Name: oi_prop_hook.patch Type: text/x-diff Size: 558 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090322/0d40225a/attachment.bin

Reply by email

Luiz Americo Pereira Camara
to Alexander Klenin
Alexander Klenin wrote 8 lines
On Sun, Mar 22, 2009 at 16:37, Alexander Klenin wrote: > 1) apply the attached patch > I somehow managed to save incorrect patch. Please use this version instead.

I applied this patch but it gives the same problem.

FYI, VTV does not define any custom property editor.

How can i know what is the property giving problem? i tried to get the name through calling GetValue in Initialize method of the TListPropertyEditor but returned Unknown.

Luiz

Reply by email

Alexander Klenin
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote
FYI, VTV does not define any custom property editor.

Ok, I was too lazy to download and install VirtualTree and so shot in the dark.

How can i know what is the property giving problem?

Call GetName or GetPropertyPath.

i tried to get the name through calling GetValue in Initialize method of the TListPropertyEditor but returned Unknown.

Hm, I do not see a way TListPropertyEditor.GetValue can return 'Unknown'... Are you sure there is no inherited class?

Alexander S. Klenin

Reply by email

Luiz Americo Pereira Camara
to Alexander Klenin
Alexander Klenin wrote 12 lines
On Sun, Mar 22, 2009 at 20:37, Luiz Americo Pereira Camara wrote: > FYI, VTV does not define any custom property editor. > Ok, I was too lazy to download and install VirtualTree and so shot in the dark. > How can i know what is the property giving problem? > Call GetName or GetPropertyPath.

Now i've got: Columns and TVirtualStringTree.Columns

The problem is that Columns is a property of Header (TVirtualStringTree.Header.Columns).

Previously Columns where streamed as a direct child of TVirtualStringTree using DefineProperties method as a workaround to Delphi bug. I removed this hack and now Columns is streamed as child of Header.
Is there any method, other than DefineProperty, that can change a property hierarchy?

FYI Columns.GetOwner returns the Header instance.

Show quoted text 7 lines
> i tried to get the name through calling GetValue in Initialize method of the > TListPropertyEditor but returned Unknown. > Hm, I do not see a way TListPropertyEditor.GetValue can return 'Unknown'... Are you sure there is no inherited class?

I called both GetValue (0 items) and inherited GetValue (Unknown).

Luiz

Reply by email

Alexander Klenin
to Luiz Americo Pereira Camara

On Sun, Mar 22, 2009 at 22:03, Luiz Americo Pereira Camara wrote:

Ok, I have installed VTV (by the way, it needs not only LCLExtensions, but MultiLog package).
I can reproduce the issue, but this time I am inclined to say this is VTV bug, since
similar properties, like StringGrid.Columns and SdfDataSet.FieldDefs work fine. Also, if I disable IsIntresting function, the IDE stops crashing, I can still see anomalies
with Columns property -- for example, TreeView part of object inspector displays garbage after invoking Columns editor for VTV component.

Show quoted text 11 lines
The problem is that Columns is a property of Header (TVirtualStringTree.Header.Columns). Previously Columns where streamed as a direct child of TVirtualStringTree using DefineProperties method as a workaround to Delphi bug. I removed this hack and now Columns is streamed as child of Header. Is there any method, other than DefineProperty, that can change a property hierarchy? FYI Columns.GetOwner returns the Header instance.

Streaming child properties correctly is, unfortunately, undocumented and clumsy process.
See e.g. r18774 for a sample of changes required (note overrides for TBasicChartSeries class).
If you will use that code, take into account a possible differences in requirement -- TChart
displays its series as child nodes in Object Inspector's treeview. You might or might not want this for VisualTreeView columns.

Alexander S. Klenin

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara: Now i've got: Columns and TVirtualStringTree.Columns The problem is that Columns is a…
Luiz Americo Pereira Camara wrote 11 lines
Alexander Klenin escreveu: > On Sun, Mar 22, 2009 at 20:37, Luiz Americo Pereira Camara > wrote: > >> How can i know what is the property giving problem? >> > Call GetName or GetPropertyPath. > Now i've got: Columns and TVirtualStringTree.Columns

Columns is a TCollection descendant but is using a TList property editor. The crash probably is due to the cast to TList (TheList:=TList(GetObjectValue);) in TListPropertyEditor.ReadElementCount

Luiz

Reply by email

Alexander Klenin
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote
Luiz Americo Pereira Camara escreveu: Columns is a TCollection descendant but is using a TList property editor. The crash probably is due to the cast to TList (TheList:=TList(GetObjectValue);) in TListPropertyEditor.ReadElementCount

I'm looking at the same piece of code now, but this seems unlikely to me. Columns should use TCollectionPropertyEditor
unless it is specifically overridden by VTV.
Debug printing seems to confirm that.
Anyway, stacktrace points at "Result:=ReadElementCount" like, which is totally insane. Is seems that virtual function table is broken?!

Alexander S. Klenin

Reply by email

Luiz Americo Pereira Camara
to Alexander Klenin: On Sun, Mar 22, 2009 at 22:03, Luiz Americo Pereira Camara Ok, I have installed VTV (by…
Alexander Klenin wrote 6 lines
On Sun, Mar 22, 2009 at 22:03, Luiz Americo Pereira Camara wrote: Ok, I have installed VTV (by the way, it needs not only LCLExtensions, but MultiLog package).

Oh yeah, sorry. When i do a release i'll remove that dependency.

I can reproduce the issue, but this time I am inclined to say this is VTV bug, since similar properties, like StringGrid.Columns and SdfDataSet.FieldDefs work fine.

The difference to that properties is that in VTV case Columns is a subproperty (child of Header).

Show quoted text 5 lines
Also, if I disable IsIntresting function, the IDE stops crashing, I can still see anomalies with Columns property -- for example, TreeView part of object inspector displays garbage after invoking Columns editor for VTV component.

The problem is that worked fine from 2 years until revision 19044. Anyway i could not find any different approach in VTV since i already removed the existent hack. Can you point any?

I've found where the crash occurs. See other mail.

Show quoted text 23 lines
> The problem is that Columns is a property of Header > (TVirtualStringTree.Header.Columns). > > Previously Columns where streamed as a direct child of > TVirtualStringTree using DefineProperties method as a workaround to > Delphi bug. I removed this hack and now Columns is streamed as child of > Header. > Is there any method, other than DefineProperty, that can change a > property hierarchy? > > FYI Columns.GetOwner returns the Header instance. > Streaming child properties correctly is, unfortunately, undocumented and clumsy process. See e.g. r18774 for a sample of changes required (note overrides for TBasicChartSeries class). If you will use that code, take into account a possible differences in requirement -- TChart displays its series as child nodes in Object Inspector's treeview. You might or might not want this for VisualTreeView columns.

I'll stick with the basics and hope that the bug can be fixed.

Luiz

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara: Columns is a TCollection descendant but is using a TList property editor. The crash…
Luiz Americo Pereira Camara wrote 23 lines
Luiz Americo Pereira Camara escreveu: > Alexander Klenin escreveu: > > >> On Sun, Mar 22, 2009 at 20:37, Luiz Americo Pereira Camara >> wrote: >> >> >>> How can i know what is the property giving problem? >>> >>> >> Call GetName or GetPropertyPath. >> >> > Now i've got: Columns and TVirtualStringTree.Columns > > Columns is a TCollection descendant but is using a TList property editor. The crash probably is due to the cast to TList (TheList:=TList(GetObjectValue);) in TListPropertyEditor.ReadElementCount

I just noticed the TCollectionPropertyEditor is a descendant of TListPropertyEditor. The crash occurs as a sigsegv in TCollectionPropertyEditor.ReadElementCount

at line:

if (Collectionnil) and (Collection is TCollection) then

Somehow GetObjectValue is returning wrong value

Luiz

Reply by email